#[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::blob::BlobRef;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon, open_union};
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::app_bsky::actor::ProfileViewBasic;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::place_stream::BlockView;
use crate::place_stream::Rendition;
use crate::place_stream::Renditions;
use crate::place_stream::chat::MessageView;
use crate::place_stream::chat::profile::Profile;
use crate::place_stream::livestream;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LivestreamView<S: BosStr = DefaultStr> {
pub author: ProfileViewBasic<S>,
pub cid: Cid<S>,
pub indexed_at: Datetime,
pub record: Data<S>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_count: Option<livestream::ViewerCount<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",
rename = "place.stream.livestream",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Livestream<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub agent: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub canonical_url: Option<UriValue<S>>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub ended_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub idle_timeout_seconds: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_seen_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub notification_settings: Option<livestream::NotificationSettings<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub post: Option<StrongRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb: Option<BlobRef<S>>,
pub title: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<UriValue<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")]
pub struct LivestreamGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Livestream<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct NotificationSettings<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub push_notification: Option<bool>,
#[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 StreamplaceAnything<S: BosStr = DefaultStr> {
pub livestream: StreamplaceAnythingLivestream<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum StreamplaceAnythingLivestream<S: BosStr = DefaultStr> {
#[serde(rename = "place.stream.livestream#livestreamView")]
LivestreamView(Box<livestream::LivestreamView<S>>),
#[serde(rename = "place.stream.livestream#viewerCount")]
ViewerCount(Box<livestream::ViewerCount<S>>),
#[serde(rename = "place.stream.livestream#teleportArrival")]
TeleportArrival(Box<livestream::TeleportArrival<S>>),
#[serde(rename = "place.stream.livestream#teleportCanceled")]
TeleportCanceled(Box<livestream::TeleportCanceled<S>>),
#[serde(rename = "place.stream.defs#blockView")]
BlockView(Box<BlockView<S>>),
#[serde(rename = "place.stream.defs#renditions")]
Renditions(Box<Renditions<S>>),
#[serde(rename = "place.stream.defs#rendition")]
Rendition(Box<Rendition<S>>),
#[serde(rename = "place.stream.chat.defs#messageView")]
MessageView(Box<MessageView<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct TeleportArrival<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub chat_profile: Option<Profile<S>>,
pub source: ProfileViewBasic<S>,
pub starts_at: Datetime,
pub teleport_uri: AtUri<S>,
pub viewer_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 TeleportCanceled<S: BosStr = DefaultStr> {
pub reason: S,
pub teleport_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 ViewerCount<S: BosStr = DefaultStr> {
pub count: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Livestream<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, LivestreamRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for LivestreamView<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"livestreamView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct LivestreamRecord;
impl XrpcResp for LivestreamRecord {
const NSID: &'static str = "place.stream.livestream";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = LivestreamGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<LivestreamGetRecordOutput<S>> for Livestream<S> {
fn from(output: LivestreamGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Livestream<S> {
const NSID: &'static str = "place.stream.livestream";
type Record = LivestreamRecord;
}
impl Collection for LivestreamRecord {
const NSID: &'static str = "place.stream.livestream";
type Record = LivestreamRecord;
}
impl<S: BosStr> LexiconSchema for Livestream<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.thumb {
{
let size = value.blob().size;
if size > 1000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("thumb"),
max: 1000000usize,
actual: size,
});
}
}
}
if let Some(ref value) = self.thumb {
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/*"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("thumb"),
accepted: vec!["image/*".to_string()],
actual: mime.to_string(),
});
}
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1400usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("title"),
max: 1400usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.title;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 140usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("title"),
max: 140usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for NotificationSettings<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"notificationSettings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for StreamplaceAnything<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"streamplaceAnything"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for TeleportArrival<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"teleportArrival"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for TeleportCanceled<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"teleportCanceled"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ViewerCount<S> {
fn nsid() -> &'static str {
"place.stream.livestream"
}
fn def_name() -> &'static str {
"viewerCount"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_livestream()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod livestream_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 Record;
type Uri;
type Cid;
type IndexedAt;
type Author;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
type Uri = Unset;
type Cid = Unset;
type IndexedAt = Unset;
type Author = Unset;
}
pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRecord<St> {}
impl<St: State> State for SetRecord<St> {
type Record = Set<members::record>;
type Uri = St::Uri;
type Cid = St::Cid;
type IndexedAt = St::IndexedAt;
type Author = St::Author;
}
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 Record = St::Record;
type Uri = Set<members::uri>;
type Cid = St::Cid;
type IndexedAt = St::IndexedAt;
type Author = St::Author;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Record = St::Record;
type Uri = St::Uri;
type Cid = Set<members::cid>;
type IndexedAt = St::IndexedAt;
type Author = St::Author;
}
pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
impl<St: State> State for SetIndexedAt<St> {
type Record = St::Record;
type Uri = St::Uri;
type Cid = St::Cid;
type IndexedAt = Set<members::indexed_at>;
type Author = St::Author;
}
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 Record = St::Record;
type Uri = St::Uri;
type Cid = St::Cid;
type IndexedAt = St::IndexedAt;
type Author = Set<members::author>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
pub struct uri(());
pub struct cid(());
pub struct indexed_at(());
pub struct author(());
}
}
pub struct LivestreamViewBuilder<S: BosStr, St: livestream_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<ProfileViewBasic<S>>,
Option<Cid<S>>,
Option<Datetime>,
Option<Data<S>>,
Option<AtUri<S>>,
Option<livestream::ViewerCount<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> LivestreamView<S> {
pub fn new() -> LivestreamViewBuilder<S, livestream_view_state::Empty> {
LivestreamViewBuilder::new()
}
}
impl<S: BosStr> LivestreamViewBuilder<S, livestream_view_state::Empty> {
pub fn new() -> Self {
LivestreamViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LivestreamViewBuilder<S, St>
where
St: livestream_view_state::State,
St::Author: livestream_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> LivestreamViewBuilder<S, livestream_view_state::SetAuthor<St>> {
self._fields.0 = Option::Some(value.into());
LivestreamViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LivestreamViewBuilder<S, St>
where
St: livestream_view_state::State,
St::Cid: livestream_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> LivestreamViewBuilder<S, livestream_view_state::SetCid<St>> {
self._fields.1 = Option::Some(value.into());
LivestreamViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LivestreamViewBuilder<S, St>
where
St: livestream_view_state::State,
St::IndexedAt: livestream_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> LivestreamViewBuilder<S, livestream_view_state::SetIndexedAt<St>> {
self._fields.2 = Option::Some(value.into());
LivestreamViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LivestreamViewBuilder<S, St>
where
St: livestream_view_state::State,
St::Record: livestream_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<S>>,
) -> LivestreamViewBuilder<S, livestream_view_state::SetRecord<St>> {
self._fields.3 = Option::Some(value.into());
LivestreamViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LivestreamViewBuilder<S, St>
where
St: livestream_view_state::State,
St::Uri: livestream_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> LivestreamViewBuilder<S, livestream_view_state::SetUri<St>> {
self._fields.4 = Option::Some(value.into());
LivestreamViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: livestream_view_state::State> LivestreamViewBuilder<S, St> {
pub fn viewer_count(
mut self,
value: impl Into<Option<livestream::ViewerCount<S>>>,
) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_viewer_count(
mut self,
value: Option<livestream::ViewerCount<S>>,
) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St> LivestreamViewBuilder<S, St>
where
St: livestream_view_state::State,
St::Record: livestream_view_state::IsSet,
St::Uri: livestream_view_state::IsSet,
St::Cid: livestream_view_state::IsSet,
St::IndexedAt: livestream_view_state::IsSet,
St::Author: livestream_view_state::IsSet,
{
pub fn build(self) -> LivestreamView<S> {
LivestreamView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
viewer_count: self._fields.5,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> LivestreamView<S> {
LivestreamView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
viewer_count: self._fields.5,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_place_stream_livestream() -> 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("place.stream.livestream"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("livestreamView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerCount"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#viewerCount"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static("Record announcing a livestream is happening"),
),
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("title"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("agent"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The source of the livestream, if available, in a User Agent format: `<product> / <product-version> <comment>` e.g. Streamplace/0.7.5 iOS",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("canonicalUrl"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The primary URL where this livestream can be viewed, if available.",
),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Client-declared timestamp when this livestream started.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("endedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Client-declared timestamp when this livestream ended. Ended livestreams are not supposed to start up again.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("idleTimeoutSeconds"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastSeenAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Client-declared timestamp when this livestream was last seen by the Streamplace station.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notificationSettings"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"place.stream.livestream#notificationSettings",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("post"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("thumb"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The title of the livestream, as it will be announced to followers.",
),
),
max_length: Some(1400usize),
max_graphemes: Some(140usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("url"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The URL where this stream can be found. This is primarily a hint for other Streamplace nodes to locate and replicate the stream.",
),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notificationSettings"),
LexUserType::Object(LexObject {
required: Some(vec![]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("pushNotification"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("streamplaceAnything"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("livestream")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("livestream"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#livestreamView"),
CowStr::new_static("#viewerCount"),
CowStr::new_static("#teleportArrival"),
CowStr::new_static("#teleportCanceled"),
CowStr::new_static("place.stream.defs#blockView"),
CowStr::new_static("place.stream.defs#renditions"),
CowStr::new_static("place.stream.defs#rendition"),
CowStr::new_static("place.stream.chat.defs#messageView")
],
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("teleportArrival"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("teleportUri"),
SmolStr::new_static("source"),
SmolStr::new_static("viewerCount"),
SmolStr::new_static("startsAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("chatProfile"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("place.stream.chat.profile"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("startsAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When this teleport started"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("teleportUri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The URI of the teleport record"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("teleportCanceled"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("teleportUri"),
SmolStr::new_static("reason")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("reason"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Why this teleport was canceled"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("teleportUri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The URI of the teleport record that was canceled",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewerCount"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("count")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("count"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod livestream_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 Title;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Title = 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 Title = St::Title;
}
pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTitle<St> {}
impl<St: State> State for SetTitle<St> {
type CreatedAt = St::CreatedAt;
type Title = Set<members::title>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct title(());
}
}
pub struct LivestreamBuilder<S: BosStr, St: livestream_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<UriValue<S>>,
Option<Datetime>,
Option<Datetime>,
Option<i64>,
Option<Datetime>,
Option<livestream::NotificationSettings<S>>,
Option<StrongRef<S>>,
Option<BlobRef<S>>,
Option<S>,
Option<UriValue<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Livestream<S> {
pub fn new() -> LivestreamBuilder<S, livestream_state::Empty> {
LivestreamBuilder::new()
}
}
impl<S: BosStr> LivestreamBuilder<S, livestream_state::Empty> {
pub fn new() -> Self {
LivestreamBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn agent(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_agent(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn canonical_url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_canonical_url(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> LivestreamBuilder<S, St>
where
St: livestream_state::State,
St::CreatedAt: livestream_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> LivestreamBuilder<S, livestream_state::SetCreatedAt<St>> {
self._fields.2 = Option::Some(value.into());
LivestreamBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn ended_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_ended_at(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn idle_timeout_seconds(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_idle_timeout_seconds(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn last_seen_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_last_seen_at(mut self, value: Option<Datetime>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn notification_settings(
mut self,
value: impl Into<Option<livestream::NotificationSettings<S>>>,
) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_notification_settings(
mut self,
value: Option<livestream::NotificationSettings<S>>,
) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn post(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_post(mut self, value: Option<StrongRef<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn thumb(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_thumb(mut self, value: Option<BlobRef<S>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St> LivestreamBuilder<S, St>
where
St: livestream_state::State,
St::Title: livestream_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> LivestreamBuilder<S, livestream_state::SetTitle<St>> {
self._fields.9 = Option::Some(value.into());
LivestreamBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: livestream_state::State> LivestreamBuilder<S, St> {
pub fn url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_url(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St> LivestreamBuilder<S, St>
where
St: livestream_state::State,
St::CreatedAt: livestream_state::IsSet,
St::Title: livestream_state::IsSet,
{
pub fn build(self) -> Livestream<S> {
Livestream {
agent: self._fields.0,
canonical_url: self._fields.1,
created_at: self._fields.2.unwrap(),
ended_at: self._fields.3,
idle_timeout_seconds: self._fields.4,
last_seen_at: self._fields.5,
notification_settings: self._fields.6,
post: self._fields.7,
thumb: self._fields.8,
title: self._fields.9.unwrap(),
url: self._fields.10,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> Livestream<S> {
Livestream {
agent: self._fields.0,
canonical_url: self._fields.1,
created_at: self._fields.2.unwrap(),
ended_at: self._fields.3,
idle_timeout_seconds: self._fields.4,
last_seen_at: self._fields.5,
notification_settings: self._fields.6,
post: self._fields.7,
thumb: self._fields.8,
title: self._fields.9.unwrap(),
url: self._fields.10,
extra_data: Some(extra_data),
}
}
}
pub mod streamplace_anything_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 Livestream;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Livestream = Unset;
}
pub struct SetLivestream<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLivestream<St> {}
impl<St: State> State for SetLivestream<St> {
type Livestream = Set<members::livestream>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct livestream(());
}
}
pub struct StreamplaceAnythingBuilder<S: BosStr, St: streamplace_anything_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<StreamplaceAnythingLivestream<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> StreamplaceAnything<S> {
pub fn new() -> StreamplaceAnythingBuilder<S, streamplace_anything_state::Empty> {
StreamplaceAnythingBuilder::new()
}
}
impl<S: BosStr> StreamplaceAnythingBuilder<S, streamplace_anything_state::Empty> {
pub fn new() -> Self {
StreamplaceAnythingBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> StreamplaceAnythingBuilder<S, St>
where
St: streamplace_anything_state::State,
St::Livestream: streamplace_anything_state::IsUnset,
{
pub fn livestream(
mut self,
value: impl Into<StreamplaceAnythingLivestream<S>>,
) -> StreamplaceAnythingBuilder<S, streamplace_anything_state::SetLivestream<St>> {
self._fields.0 = Option::Some(value.into());
StreamplaceAnythingBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> StreamplaceAnythingBuilder<S, St>
where
St: streamplace_anything_state::State,
St::Livestream: streamplace_anything_state::IsSet,
{
pub fn build(self) -> StreamplaceAnything<S> {
StreamplaceAnything {
livestream: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> StreamplaceAnything<S> {
StreamplaceAnything {
livestream: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod teleport_arrival_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 Source;
type TeleportUri;
type ViewerCount;
type StartsAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Source = Unset;
type TeleportUri = Unset;
type ViewerCount = Unset;
type StartsAt = Unset;
}
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 Source = Set<members::source>;
type TeleportUri = St::TeleportUri;
type ViewerCount = St::ViewerCount;
type StartsAt = St::StartsAt;
}
pub struct SetTeleportUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTeleportUri<St> {}
impl<St: State> State for SetTeleportUri<St> {
type Source = St::Source;
type TeleportUri = Set<members::teleport_uri>;
type ViewerCount = St::ViewerCount;
type StartsAt = St::StartsAt;
}
pub struct SetViewerCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetViewerCount<St> {}
impl<St: State> State for SetViewerCount<St> {
type Source = St::Source;
type TeleportUri = St::TeleportUri;
type ViewerCount = Set<members::viewer_count>;
type StartsAt = St::StartsAt;
}
pub struct SetStartsAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStartsAt<St> {}
impl<St: State> State for SetStartsAt<St> {
type Source = St::Source;
type TeleportUri = St::TeleportUri;
type ViewerCount = St::ViewerCount;
type StartsAt = Set<members::starts_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct source(());
pub struct teleport_uri(());
pub struct viewer_count(());
pub struct starts_at(());
}
}
pub struct TeleportArrivalBuilder<S: BosStr, St: teleport_arrival_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Profile<S>>,
Option<ProfileViewBasic<S>>,
Option<Datetime>,
Option<AtUri<S>>,
Option<i64>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> TeleportArrival<S> {
pub fn new() -> TeleportArrivalBuilder<S, teleport_arrival_state::Empty> {
TeleportArrivalBuilder::new()
}
}
impl<S: BosStr> TeleportArrivalBuilder<S, teleport_arrival_state::Empty> {
pub fn new() -> Self {
TeleportArrivalBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: teleport_arrival_state::State> TeleportArrivalBuilder<S, St> {
pub fn chat_profile(mut self, value: impl Into<Option<Profile<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_chat_profile(mut self, value: Option<Profile<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> TeleportArrivalBuilder<S, St>
where
St: teleport_arrival_state::State,
St::Source: teleport_arrival_state::IsUnset,
{
pub fn source(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> TeleportArrivalBuilder<S, teleport_arrival_state::SetSource<St>> {
self._fields.1 = Option::Some(value.into());
TeleportArrivalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportArrivalBuilder<S, St>
where
St: teleport_arrival_state::State,
St::StartsAt: teleport_arrival_state::IsUnset,
{
pub fn starts_at(
mut self,
value: impl Into<Datetime>,
) -> TeleportArrivalBuilder<S, teleport_arrival_state::SetStartsAt<St>> {
self._fields.2 = Option::Some(value.into());
TeleportArrivalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportArrivalBuilder<S, St>
where
St: teleport_arrival_state::State,
St::TeleportUri: teleport_arrival_state::IsUnset,
{
pub fn teleport_uri(
mut self,
value: impl Into<AtUri<S>>,
) -> TeleportArrivalBuilder<S, teleport_arrival_state::SetTeleportUri<St>> {
self._fields.3 = Option::Some(value.into());
TeleportArrivalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportArrivalBuilder<S, St>
where
St: teleport_arrival_state::State,
St::ViewerCount: teleport_arrival_state::IsUnset,
{
pub fn viewer_count(
mut self,
value: impl Into<i64>,
) -> TeleportArrivalBuilder<S, teleport_arrival_state::SetViewerCount<St>> {
self._fields.4 = Option::Some(value.into());
TeleportArrivalBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportArrivalBuilder<S, St>
where
St: teleport_arrival_state::State,
St::Source: teleport_arrival_state::IsSet,
St::TeleportUri: teleport_arrival_state::IsSet,
St::ViewerCount: teleport_arrival_state::IsSet,
St::StartsAt: teleport_arrival_state::IsSet,
{
pub fn build(self) -> TeleportArrival<S> {
TeleportArrival {
chat_profile: self._fields.0,
source: self._fields.1.unwrap(),
starts_at: self._fields.2.unwrap(),
teleport_uri: self._fields.3.unwrap(),
viewer_count: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> TeleportArrival<S> {
TeleportArrival {
chat_profile: self._fields.0,
source: self._fields.1.unwrap(),
starts_at: self._fields.2.unwrap(),
teleport_uri: self._fields.3.unwrap(),
viewer_count: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod teleport_canceled_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 Reason;
type TeleportUri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Reason = Unset;
type TeleportUri = Unset;
}
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 Reason = Set<members::reason>;
type TeleportUri = St::TeleportUri;
}
pub struct SetTeleportUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTeleportUri<St> {}
impl<St: State> State for SetTeleportUri<St> {
type Reason = St::Reason;
type TeleportUri = Set<members::teleport_uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct reason(());
pub struct teleport_uri(());
}
}
pub struct TeleportCanceledBuilder<S: BosStr, St: teleport_canceled_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> TeleportCanceled<S> {
pub fn new() -> TeleportCanceledBuilder<S, teleport_canceled_state::Empty> {
TeleportCanceledBuilder::new()
}
}
impl<S: BosStr> TeleportCanceledBuilder<S, teleport_canceled_state::Empty> {
pub fn new() -> Self {
TeleportCanceledBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportCanceledBuilder<S, St>
where
St: teleport_canceled_state::State,
St::Reason: teleport_canceled_state::IsUnset,
{
pub fn reason(
mut self,
value: impl Into<S>,
) -> TeleportCanceledBuilder<S, teleport_canceled_state::SetReason<St>> {
self._fields.0 = Option::Some(value.into());
TeleportCanceledBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportCanceledBuilder<S, St>
where
St: teleport_canceled_state::State,
St::TeleportUri: teleport_canceled_state::IsUnset,
{
pub fn teleport_uri(
mut self,
value: impl Into<AtUri<S>>,
) -> TeleportCanceledBuilder<S, teleport_canceled_state::SetTeleportUri<St>> {
self._fields.1 = Option::Some(value.into());
TeleportCanceledBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TeleportCanceledBuilder<S, St>
where
St: teleport_canceled_state::State,
St::Reason: teleport_canceled_state::IsSet,
St::TeleportUri: teleport_canceled_state::IsSet,
{
pub fn build(self) -> TeleportCanceled<S> {
TeleportCanceled {
reason: self._fields.0.unwrap(),
teleport_uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> TeleportCanceled<S> {
TeleportCanceled {
reason: self._fields.0.unwrap(),
teleport_uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod viewer_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 Count;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Count = Unset;
}
pub struct SetCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCount<St> {}
impl<St: State> State for SetCount<St> {
type Count = Set<members::count>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct count(());
}
}
pub struct ViewerCountBuilder<S: BosStr, St: viewer_count_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ViewerCount<S> {
pub fn new() -> ViewerCountBuilder<S, viewer_count_state::Empty> {
ViewerCountBuilder::new()
}
}
impl<S: BosStr> ViewerCountBuilder<S, viewer_count_state::Empty> {
pub fn new() -> Self {
ViewerCountBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewerCountBuilder<S, St>
where
St: viewer_count_state::State,
St::Count: viewer_count_state::IsUnset,
{
pub fn count(
mut self,
value: impl Into<i64>,
) -> ViewerCountBuilder<S, viewer_count_state::SetCount<St>> {
self._fields.0 = Option::Some(value.into());
ViewerCountBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ViewerCountBuilder<S, St>
where
St: viewer_count_state::State,
St::Count: viewer_count_state::IsSet,
{
pub fn build(self) -> ViewerCount<S> {
ViewerCount {
count: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ViewerCount<S> {
ViewerCount {
count: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}