pub mod actor;
pub mod audio;
pub mod comment;
pub mod favorite;
pub mod get_comments;
pub mod get_favorites;
pub mod get_global_recently_played;
pub mod get_listener_counts;
pub mod get_notifications;
pub mod get_recently_played;
pub mod get_stations;
pub mod reaction;
pub mod station;
pub mod update_seen;
#[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::ident::AtIdentifier;
use jacquard_common::types::string::{Did, AtUri, Datetime, UriValue};
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};
use crate::fm_atradio::comment::Gif;
use crate::fm_atradio::comment::Mention;
use crate::fm_atradio;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ActorInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<UriValue<S>>,
pub did: Did<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub display_name: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub handle: Option<AtIdentifier<S>>,
#[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 CommentView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<fm_atradio::ActorInfo<S>>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub facets: Option<Vec<Mention<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub gif: Option<Gif<S>>,
pub station: fm_atradio::StationInfo<S>,
pub text: S,
pub uri: AtUri<S>,
#[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 ListenerCount<S: BosStr = DefaultStr> {
pub listeners: i64,
pub station_id: S,
#[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 NotificationView<S: BosStr = DefaultStr> {
pub author: fm_atradio::ActorInfo<S>,
pub created_at: Datetime,
pub is_read: bool,
pub reason: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub station: Option<fm_atradio::StationInfo<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<S>,
pub uri: AtUri<S>,
#[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 PlayView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub actor: Option<fm_atradio::ActorInfo<S>>,
pub played_at: Datetime,
pub station: fm_atradio::StationInfo<S>,
#[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 StationInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub bitrate: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub codec: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub genre: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub homepage: Option<UriValue<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub logo: Option<UriValue<S>>,
pub name: S,
pub source: S,
pub station_id: S,
pub stream_url: UriValue<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<S>>,
#[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 StationView<S: BosStr = DefaultStr> {
pub created_at: Datetime,
pub station: fm_atradio::StationInfo<S>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for ActorInfo<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"actorInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for CommentView<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"commentView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ListenerCount<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"listenerCount"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.listeners;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("listeners"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for NotificationView<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"notificationView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PlayView<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"playView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for StationInfo<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"stationInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.bitrate {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("bitrate"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("description"),
max: 2000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.genre {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("genre"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.name;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 512usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 512usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.name;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 1usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("name"),
min: 1usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.station_id;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 512usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("station_id"),
max: 512usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for StationView<S> {
fn nsid() -> &'static str {
"fm.atradio.defs"
}
fn def_name() -> &'static str {
"stationView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_atradio_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod actor_info_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 Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
}
}
pub struct ActorInfoBuilder<St: actor_info_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<UriValue<S>>, Option<Did<S>>, Option<S>, Option<AtIdentifier<S>>),
_type: PhantomData<fn() -> S>,
}
impl ActorInfo<DefaultStr> {
pub fn new() -> ActorInfoBuilder<actor_info_state::Empty, DefaultStr> {
ActorInfoBuilder::new()
}
}
impl<S: BosStr> ActorInfo<S> {
pub fn builder() -> ActorInfoBuilder<actor_info_state::Empty, S> {
ActorInfoBuilder::builder()
}
}
impl ActorInfoBuilder<actor_info_state::Empty, DefaultStr> {
pub fn new() -> Self {
ActorInfoBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ActorInfoBuilder<actor_info_state::Empty, S> {
pub fn builder() -> Self {
ActorInfoBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<St: actor_info_state::State, S: BosStr> ActorInfoBuilder<St, S> {
pub fn avatar(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_avatar(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<St, S: BosStr> ActorInfoBuilder<St, S>
where
St: actor_info_state::State,
St::Did: actor_info_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> ActorInfoBuilder<actor_info_state::SetDid<St>, S> {
self._fields.1 = Option::Some(value.into());
ActorInfoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: actor_info_state::State, S: BosStr> ActorInfoBuilder<St, S> {
pub fn display_name(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_display_name(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<St: actor_info_state::State, S: BosStr> ActorInfoBuilder<St, S> {
pub fn handle(mut self, value: impl Into<Option<AtIdentifier<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_handle(mut self, value: Option<AtIdentifier<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<St, S: BosStr> ActorInfoBuilder<St, S>
where
St: actor_info_state::State,
St::Did: actor_info_state::IsSet,
{
pub fn build(self) -> ActorInfo<S> {
ActorInfo {
avatar: self._fields.0,
did: self._fields.1.unwrap(),
display_name: self._fields.2,
handle: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ActorInfo<S> {
ActorInfo {
avatar: self._fields.0,
did: self._fields.1.unwrap(),
display_name: self._fields.2,
handle: self._fields.3,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_fm_atradio_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.atradio.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("actorInfo"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("A minimal public snapshot of an actor."),
),
required: Some(vec![SmolStr::new_static("did")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("avatar"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Avatar URL.")),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("displayName"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("handle"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtIdentifier),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("commentView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A comment on a station, paired with its record uri and author.",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("station"),
SmolStr::new_static("text"), SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#actorInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("facets"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.comment#mention"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("gif"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.comment#gif"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("station"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#stationInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("listenerCount"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Unique-listener count for a single station."),
),
required: Some(
vec![
SmolStr::new_static("stationId"),
SmolStr::new_static("listeners")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("listeners"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("stationId"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notificationView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("A single notification for an actor."),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("reason"),
SmolStr::new_static("author"),
SmolStr::new_static("createdAt"),
SmolStr::new_static("isRead")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#actorInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isRead"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reason"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Why this notification exists: mention | comment.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("station"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#stationInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Snapshot of the comment text."),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"URI of the subject record (the comment).",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("playView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A single play event: a station an actor listened to at a point in time.",
),
),
required: Some(
vec![
SmolStr::new_static("station"),
SmolStr::new_static("playedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("actor"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#actorInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("playedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("station"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#stationInfo"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("stationInfo"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A self-contained snapshot of a radio station.",
),
),
required: Some(
vec![
SmolStr::new_static("stationId"),
SmolStr::new_static("name"),
SmolStr::new_static("streamUrl"),
SmolStr::new_static("source")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bitrate"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("codec"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("country"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString {
max_length: Some(2000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("genre"),
LexObjectProperty::String(LexString {
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("homepage"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("language"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("logo"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Logo/artwork URL.")),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
min_length: Some(1usize),
max_length: Some(512usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Provider: radio-browser | tunein | custom.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("stationId"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Source-prefixed stable id, e.g. rb:uuid, tunein:s123, custom:xyz.",
),
),
max_length: Some(512usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("streamUrl"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Direct, playable stream URL."),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::String(LexString {
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("stationView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A station snapshot paired with its record uri (query output item).",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("station"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("station"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("fm.atradio.defs#stationInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod comment_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 CreatedAt;
type Station;
type Text;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Station = Unset;
type Text = Unset;
type Uri = Unset;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type CreatedAt = Set<members::created_at>;
type Station = St::Station;
type Text = St::Text;
type Uri = St::Uri;
}
pub struct SetStation<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStation<St> {}
impl<St: State> State for SetStation<St> {
type CreatedAt = St::CreatedAt;
type Station = Set<members::station>;
type Text = St::Text;
type Uri = St::Uri;
}
pub struct SetText<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetText<St> {}
impl<St: State> State for SetText<St> {
type CreatedAt = St::CreatedAt;
type Station = St::Station;
type Text = Set<members::text>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type CreatedAt = St::CreatedAt;
type Station = St::Station;
type Text = St::Text;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct station(());
pub struct text(());
pub struct uri(());
}
}
pub struct CommentViewBuilder<St: comment_view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<fm_atradio::ActorInfo<S>>,
Option<Datetime>,
Option<Vec<Mention<S>>>,
Option<Gif<S>>,
Option<fm_atradio::StationInfo<S>>,
Option<S>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl CommentView<DefaultStr> {
pub fn new() -> CommentViewBuilder<comment_view_state::Empty, DefaultStr> {
CommentViewBuilder::new()
}
}
impl<S: BosStr> CommentView<S> {
pub fn builder() -> CommentViewBuilder<comment_view_state::Empty, S> {
CommentViewBuilder::builder()
}
}
impl CommentViewBuilder<comment_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
CommentViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> CommentViewBuilder<comment_view_state::Empty, S> {
pub fn builder() -> Self {
CommentViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St: comment_view_state::State, S: BosStr> CommentViewBuilder<St, S> {
pub fn author(mut self, value: impl Into<Option<fm_atradio::ActorInfo<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_author(mut self, value: Option<fm_atradio::ActorInfo<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<St, S: BosStr> CommentViewBuilder<St, S>
where
St: comment_view_state::State,
St::CreatedAt: comment_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> CommentViewBuilder<comment_view_state::SetCreatedAt<St>, S> {
self._fields.1 = Option::Some(value.into());
CommentViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: comment_view_state::State, S: BosStr> CommentViewBuilder<St, S> {
pub fn facets(mut self, value: impl Into<Option<Vec<Mention<S>>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_facets(mut self, value: Option<Vec<Mention<S>>>) -> Self {
self._fields.2 = value;
self
}
}
impl<St: comment_view_state::State, S: BosStr> CommentViewBuilder<St, S> {
pub fn gif(mut self, value: impl Into<Option<Gif<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_gif(mut self, value: Option<Gif<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<St, S: BosStr> CommentViewBuilder<St, S>
where
St: comment_view_state::State,
St::Station: comment_view_state::IsUnset,
{
pub fn station(
mut self,
value: impl Into<fm_atradio::StationInfo<S>>,
) -> CommentViewBuilder<comment_view_state::SetStation<St>, S> {
self._fields.4 = Option::Some(value.into());
CommentViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> CommentViewBuilder<St, S>
where
St: comment_view_state::State,
St::Text: comment_view_state::IsUnset,
{
pub fn text(
mut self,
value: impl Into<S>,
) -> CommentViewBuilder<comment_view_state::SetText<St>, S> {
self._fields.5 = Option::Some(value.into());
CommentViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> CommentViewBuilder<St, S>
where
St: comment_view_state::State,
St::Uri: comment_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> CommentViewBuilder<comment_view_state::SetUri<St>, S> {
self._fields.6 = Option::Some(value.into());
CommentViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> CommentViewBuilder<St, S>
where
St: comment_view_state::State,
St::CreatedAt: comment_view_state::IsSet,
St::Station: comment_view_state::IsSet,
St::Text: comment_view_state::IsSet,
St::Uri: comment_view_state::IsSet,
{
pub fn build(self) -> CommentView<S> {
CommentView {
author: self._fields.0,
created_at: self._fields.1.unwrap(),
facets: self._fields.2,
gif: self._fields.3,
station: self._fields.4.unwrap(),
text: self._fields.5.unwrap(),
uri: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> CommentView<S> {
CommentView {
author: self._fields.0,
created_at: self._fields.1.unwrap(),
facets: self._fields.2,
gif: self._fields.3,
station: self._fields.4.unwrap(),
text: self._fields.5.unwrap(),
uri: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod listener_count_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 Listeners;
type StationId;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Listeners = Unset;
type StationId = Unset;
}
pub struct SetListeners<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetListeners<St> {}
impl<St: State> State for SetListeners<St> {
type Listeners = Set<members::listeners>;
type StationId = St::StationId;
}
pub struct SetStationId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStationId<St> {}
impl<St: State> State for SetStationId<St> {
type Listeners = St::Listeners;
type StationId = Set<members::station_id>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct listeners(());
pub struct station_id(());
}
}
pub struct ListenerCountBuilder<
St: listener_count_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl ListenerCount<DefaultStr> {
pub fn new() -> ListenerCountBuilder<listener_count_state::Empty, DefaultStr> {
ListenerCountBuilder::new()
}
}
impl<S: BosStr> ListenerCount<S> {
pub fn builder() -> ListenerCountBuilder<listener_count_state::Empty, S> {
ListenerCountBuilder::builder()
}
}
impl ListenerCountBuilder<listener_count_state::Empty, DefaultStr> {
pub fn new() -> Self {
ListenerCountBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ListenerCountBuilder<listener_count_state::Empty, S> {
pub fn builder() -> Self {
ListenerCountBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ListenerCountBuilder<St, S>
where
St: listener_count_state::State,
St::Listeners: listener_count_state::IsUnset,
{
pub fn listeners(
mut self,
value: impl Into<i64>,
) -> ListenerCountBuilder<listener_count_state::SetListeners<St>, S> {
self._fields.0 = Option::Some(value.into());
ListenerCountBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ListenerCountBuilder<St, S>
where
St: listener_count_state::State,
St::StationId: listener_count_state::IsUnset,
{
pub fn station_id(
mut self,
value: impl Into<S>,
) -> ListenerCountBuilder<listener_count_state::SetStationId<St>, S> {
self._fields.1 = Option::Some(value.into());
ListenerCountBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ListenerCountBuilder<St, S>
where
St: listener_count_state::State,
St::Listeners: listener_count_state::IsSet,
St::StationId: listener_count_state::IsSet,
{
pub fn build(self) -> ListenerCount<S> {
ListenerCount {
listeners: self._fields.0.unwrap(),
station_id: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ListenerCount<S> {
ListenerCount {
listeners: self._fields.0.unwrap(),
station_id: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod notification_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 Author;
type CreatedAt;
type IsRead;
type Reason;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Author = Unset;
type CreatedAt = Unset;
type IsRead = Unset;
type Reason = Unset;
type Uri = Unset;
}
pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAuthor<St> {}
impl<St: State> State for SetAuthor<St> {
type Author = Set<members::author>;
type CreatedAt = St::CreatedAt;
type IsRead = St::IsRead;
type Reason = St::Reason;
type Uri = St::Uri;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Author = St::Author;
type CreatedAt = Set<members::created_at>;
type IsRead = St::IsRead;
type Reason = St::Reason;
type Uri = St::Uri;
}
pub struct SetIsRead<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIsRead<St> {}
impl<St: State> State for SetIsRead<St> {
type Author = St::Author;
type CreatedAt = St::CreatedAt;
type IsRead = Set<members::is_read>;
type Reason = St::Reason;
type Uri = St::Uri;
}
pub struct SetReason<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReason<St> {}
impl<St: State> State for SetReason<St> {
type Author = St::Author;
type CreatedAt = St::CreatedAt;
type IsRead = St::IsRead;
type Reason = Set<members::reason>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Author = St::Author;
type CreatedAt = St::CreatedAt;
type IsRead = St::IsRead;
type Reason = St::Reason;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct author(());
pub struct created_at(());
pub struct is_read(());
pub struct reason(());
pub struct uri(());
}
}
pub struct NotificationViewBuilder<
St: notification_view_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<fm_atradio::ActorInfo<S>>,
Option<Datetime>,
Option<bool>,
Option<S>,
Option<fm_atradio::StationInfo<S>>,
Option<S>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl NotificationView<DefaultStr> {
pub fn new() -> NotificationViewBuilder<notification_view_state::Empty, DefaultStr> {
NotificationViewBuilder::new()
}
}
impl<S: BosStr> NotificationView<S> {
pub fn builder() -> NotificationViewBuilder<notification_view_state::Empty, S> {
NotificationViewBuilder::builder()
}
}
impl NotificationViewBuilder<notification_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
NotificationViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> NotificationViewBuilder<notification_view_state::Empty, S> {
pub fn builder() -> Self {
NotificationViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> NotificationViewBuilder<St, S>
where
St: notification_view_state::State,
St::Author: notification_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<fm_atradio::ActorInfo<S>>,
) -> NotificationViewBuilder<notification_view_state::SetAuthor<St>, S> {
self._fields.0 = Option::Some(value.into());
NotificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> NotificationViewBuilder<St, S>
where
St: notification_view_state::State,
St::CreatedAt: notification_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> NotificationViewBuilder<notification_view_state::SetCreatedAt<St>, S> {
self._fields.1 = Option::Some(value.into());
NotificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> NotificationViewBuilder<St, S>
where
St: notification_view_state::State,
St::IsRead: notification_view_state::IsUnset,
{
pub fn is_read(
mut self,
value: impl Into<bool>,
) -> NotificationViewBuilder<notification_view_state::SetIsRead<St>, S> {
self._fields.2 = Option::Some(value.into());
NotificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> NotificationViewBuilder<St, S>
where
St: notification_view_state::State,
St::Reason: notification_view_state::IsUnset,
{
pub fn reason(
mut self,
value: impl Into<S>,
) -> NotificationViewBuilder<notification_view_state::SetReason<St>, S> {
self._fields.3 = Option::Some(value.into());
NotificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: notification_view_state::State, S: BosStr> NotificationViewBuilder<St, S> {
pub fn station(
mut self,
value: impl Into<Option<fm_atradio::StationInfo<S>>>,
) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_station(mut self, value: Option<fm_atradio::StationInfo<S>>) -> Self {
self._fields.4 = value;
self
}
}
impl<St: notification_view_state::State, S: BosStr> NotificationViewBuilder<St, S> {
pub fn text(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_text(mut self, value: Option<S>) -> Self {
self._fields.5 = value;
self
}
}
impl<St, S: BosStr> NotificationViewBuilder<St, S>
where
St: notification_view_state::State,
St::Uri: notification_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> NotificationViewBuilder<notification_view_state::SetUri<St>, S> {
self._fields.6 = Option::Some(value.into());
NotificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> NotificationViewBuilder<St, S>
where
St: notification_view_state::State,
St::Author: notification_view_state::IsSet,
St::CreatedAt: notification_view_state::IsSet,
St::IsRead: notification_view_state::IsSet,
St::Reason: notification_view_state::IsSet,
St::Uri: notification_view_state::IsSet,
{
pub fn build(self) -> NotificationView<S> {
NotificationView {
author: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
is_read: self._fields.2.unwrap(),
reason: self._fields.3.unwrap(),
station: self._fields.4,
text: self._fields.5,
uri: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> NotificationView<S> {
NotificationView {
author: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
is_read: self._fields.2.unwrap(),
reason: self._fields.3.unwrap(),
station: self._fields.4,
text: self._fields.5,
uri: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod play_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 PlayedAt;
type Station;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type PlayedAt = Unset;
type Station = Unset;
}
pub struct SetPlayedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPlayedAt<St> {}
impl<St: State> State for SetPlayedAt<St> {
type PlayedAt = Set<members::played_at>;
type Station = St::Station;
}
pub struct SetStation<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStation<St> {}
impl<St: State> State for SetStation<St> {
type PlayedAt = St::PlayedAt;
type Station = Set<members::station>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct played_at(());
pub struct station(());
}
}
pub struct PlayViewBuilder<St: play_view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<fm_atradio::ActorInfo<S>>,
Option<Datetime>,
Option<fm_atradio::StationInfo<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl PlayView<DefaultStr> {
pub fn new() -> PlayViewBuilder<play_view_state::Empty, DefaultStr> {
PlayViewBuilder::new()
}
}
impl<S: BosStr> PlayView<S> {
pub fn builder() -> PlayViewBuilder<play_view_state::Empty, S> {
PlayViewBuilder::builder()
}
}
impl PlayViewBuilder<play_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
PlayViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> PlayViewBuilder<play_view_state::Empty, S> {
pub fn builder() -> Self {
PlayViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<St: play_view_state::State, S: BosStr> PlayViewBuilder<St, S> {
pub fn actor(mut self, value: impl Into<Option<fm_atradio::ActorInfo<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_actor(mut self, value: Option<fm_atradio::ActorInfo<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<St, S: BosStr> PlayViewBuilder<St, S>
where
St: play_view_state::State,
St::PlayedAt: play_view_state::IsUnset,
{
pub fn played_at(
mut self,
value: impl Into<Datetime>,
) -> PlayViewBuilder<play_view_state::SetPlayedAt<St>, S> {
self._fields.1 = Option::Some(value.into());
PlayViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PlayViewBuilder<St, S>
where
St: play_view_state::State,
St::Station: play_view_state::IsUnset,
{
pub fn station(
mut self,
value: impl Into<fm_atradio::StationInfo<S>>,
) -> PlayViewBuilder<play_view_state::SetStation<St>, S> {
self._fields.2 = Option::Some(value.into());
PlayViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PlayViewBuilder<St, S>
where
St: play_view_state::State,
St::PlayedAt: play_view_state::IsSet,
St::Station: play_view_state::IsSet,
{
pub fn build(self) -> PlayView<S> {
PlayView {
actor: self._fields.0,
played_at: self._fields.1.unwrap(),
station: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> PlayView<S> {
PlayView {
actor: self._fields.0,
played_at: self._fields.1.unwrap(),
station: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod station_info_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 Source;
type StationId;
type StreamUrl;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type Source = Unset;
type StationId = Unset;
type StreamUrl = 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 Source = St::Source;
type StationId = St::StationId;
type StreamUrl = St::StreamUrl;
}
pub struct SetSource<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSource<St> {}
impl<St: State> State for SetSource<St> {
type Name = St::Name;
type Source = Set<members::source>;
type StationId = St::StationId;
type StreamUrl = St::StreamUrl;
}
pub struct SetStationId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStationId<St> {}
impl<St: State> State for SetStationId<St> {
type Name = St::Name;
type Source = St::Source;
type StationId = Set<members::station_id>;
type StreamUrl = St::StreamUrl;
}
pub struct SetStreamUrl<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStreamUrl<St> {}
impl<St: State> State for SetStreamUrl<St> {
type Name = St::Name;
type Source = St::Source;
type StationId = St::StationId;
type StreamUrl = Set<members::stream_url>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct source(());
pub struct station_id(());
pub struct stream_url(());
}
}
pub struct StationInfoBuilder<St: station_info_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<i64>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<UriValue<S>>,
Option<S>,
Option<UriValue<S>>,
Option<S>,
Option<S>,
Option<S>,
Option<UriValue<S>>,
Option<Vec<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl StationInfo<DefaultStr> {
pub fn new() -> StationInfoBuilder<station_info_state::Empty, DefaultStr> {
StationInfoBuilder::new()
}
}
impl<S: BosStr> StationInfo<S> {
pub fn builder() -> StationInfoBuilder<station_info_state::Empty, S> {
StationInfoBuilder::builder()
}
}
impl StationInfoBuilder<station_info_state::Empty, DefaultStr> {
pub fn new() -> Self {
StationInfoBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> StationInfoBuilder<station_info_state::Empty, S> {
pub fn builder() -> Self {
StationInfoBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn bitrate(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_bitrate(mut self, value: Option<i64>) -> Self {
self._fields.0 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn codec(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_codec(mut self, value: Option<S>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn country(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_country(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<S>) -> Self {
self._fields.3 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn genre(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_genre(mut self, value: Option<S>) -> Self {
self._fields.4 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn homepage(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_homepage(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn language(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_language(mut self, value: Option<S>) -> Self {
self._fields.6 = value;
self
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn logo(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_logo(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<St, S: BosStr> StationInfoBuilder<St, S>
where
St: station_info_state::State,
St::Name: station_info_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<S>,
) -> StationInfoBuilder<station_info_state::SetName<St>, S> {
self._fields.8 = Option::Some(value.into());
StationInfoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationInfoBuilder<St, S>
where
St: station_info_state::State,
St::Source: station_info_state::IsUnset,
{
pub fn source(
mut self,
value: impl Into<S>,
) -> StationInfoBuilder<station_info_state::SetSource<St>, S> {
self._fields.9 = Option::Some(value.into());
StationInfoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationInfoBuilder<St, S>
where
St: station_info_state::State,
St::StationId: station_info_state::IsUnset,
{
pub fn station_id(
mut self,
value: impl Into<S>,
) -> StationInfoBuilder<station_info_state::SetStationId<St>, S> {
self._fields.10 = Option::Some(value.into());
StationInfoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationInfoBuilder<St, S>
where
St: station_info_state::State,
St::StreamUrl: station_info_state::IsUnset,
{
pub fn stream_url(
mut self,
value: impl Into<UriValue<S>>,
) -> StationInfoBuilder<station_info_state::SetStreamUrl<St>, S> {
self._fields.11 = Option::Some(value.into());
StationInfoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: station_info_state::State, S: BosStr> StationInfoBuilder<St, S> {
pub fn tags(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<Vec<S>>) -> Self {
self._fields.12 = value;
self
}
}
impl<St, S: BosStr> StationInfoBuilder<St, S>
where
St: station_info_state::State,
St::Name: station_info_state::IsSet,
St::Source: station_info_state::IsSet,
St::StationId: station_info_state::IsSet,
St::StreamUrl: station_info_state::IsSet,
{
pub fn build(self) -> StationInfo<S> {
StationInfo {
bitrate: self._fields.0,
codec: self._fields.1,
country: self._fields.2,
description: self._fields.3,
genre: self._fields.4,
homepage: self._fields.5,
language: self._fields.6,
logo: self._fields.7,
name: self._fields.8.unwrap(),
source: self._fields.9.unwrap(),
station_id: self._fields.10.unwrap(),
stream_url: self._fields.11.unwrap(),
tags: self._fields.12,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> StationInfo<S> {
StationInfo {
bitrate: self._fields.0,
codec: self._fields.1,
country: self._fields.2,
description: self._fields.3,
genre: self._fields.4,
homepage: self._fields.5,
language: self._fields.6,
logo: self._fields.7,
name: self._fields.8.unwrap(),
source: self._fields.9.unwrap(),
station_id: self._fields.10.unwrap(),
stream_url: self._fields.11.unwrap(),
tags: self._fields.12,
extra_data: Some(extra_data),
}
}
}
pub mod station_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 CreatedAt;
type Station;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Station = Unset;
type Uri = Unset;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type CreatedAt = Set<members::created_at>;
type Station = St::Station;
type Uri = St::Uri;
}
pub struct SetStation<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStation<St> {}
impl<St: State> State for SetStation<St> {
type CreatedAt = St::CreatedAt;
type Station = Set<members::station>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type CreatedAt = St::CreatedAt;
type Station = St::Station;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct station(());
pub struct uri(());
}
}
pub struct StationViewBuilder<St: station_view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Datetime>, Option<fm_atradio::StationInfo<S>>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl StationView<DefaultStr> {
pub fn new() -> StationViewBuilder<station_view_state::Empty, DefaultStr> {
StationViewBuilder::new()
}
}
impl<S: BosStr> StationView<S> {
pub fn builder() -> StationViewBuilder<station_view_state::Empty, S> {
StationViewBuilder::builder()
}
}
impl StationViewBuilder<station_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
StationViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> StationViewBuilder<station_view_state::Empty, S> {
pub fn builder() -> Self {
StationViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationViewBuilder<St, S>
where
St: station_view_state::State,
St::CreatedAt: station_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> StationViewBuilder<station_view_state::SetCreatedAt<St>, S> {
self._fields.0 = Option::Some(value.into());
StationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationViewBuilder<St, S>
where
St: station_view_state::State,
St::Station: station_view_state::IsUnset,
{
pub fn station(
mut self,
value: impl Into<fm_atradio::StationInfo<S>>,
) -> StationViewBuilder<station_view_state::SetStation<St>, S> {
self._fields.1 = Option::Some(value.into());
StationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationViewBuilder<St, S>
where
St: station_view_state::State,
St::Uri: station_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> StationViewBuilder<station_view_state::SetUri<St>, S> {
self._fields.2 = Option::Some(value.into());
StationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StationViewBuilder<St, S>
where
St: station_view_state::State,
St::CreatedAt: station_view_state::IsSet,
St::Station: station_view_state::IsSet,
St::Uri: station_view_state::IsSet,
{
pub fn build(self) -> StationView<S> {
StationView {
created_at: self._fields.0.unwrap(),
station: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> StationView<S> {
StationView {
created_at: self._fields.0.unwrap(),
station: self._fields.1.unwrap(),
uri: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}