#[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::collection::{Collection, RecordError};
use jacquard_common::types::string::{Did, AtUri, Cid};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::place_stream::chat::profile;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct BadgeSelections<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub global: Option<StrongRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub streamer: Option<Vec<profile::StreamerBadgeSelection<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 Color<S: BosStr = DefaultStr> {
pub blue: i64,
pub green: i64,
pub red: 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",
rename = "place.stream.chat.profile",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Profile<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub badges: Option<profile::BadgeSelections<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub color: Option<profile::Color<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub self_labels: Option<Vec<profile::SelfLabel<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 ProfileGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Profile<S>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SelfLabel<S: BosStr = DefaultStr> {
Bot,
Other(S),
}
impl<S: BosStr> SelfLabel<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Bot => "bot",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"bot" => Self::Bot,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> AsRef<str> for SelfLabel<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> core::fmt::Display for SelfLabel<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> Serialize for SelfLabel<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for SelfLabel<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr> jacquard_common::IntoStatic for SelfLabel<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = SelfLabel<S::Output>;
fn into_static(self) -> Self::Output {
match self {
SelfLabel::Bot => SelfLabel::Bot,
SelfLabel::Other(v) => SelfLabel::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct StreamerBadgeSelection<S: BosStr = DefaultStr> {
pub badge: StrongRef<S>,
pub streamer: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Profile<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, ProfileRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for BadgeSelections<S> {
fn nsid() -> &'static str {
"place.stream.chat.profile"
}
fn def_name() -> &'static str {
"badgeSelections"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_chat_profile()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.streamer {
#[allow(unused_comparisons)]
if value.len() > 20usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("streamer"),
max: 20usize,
actual: value.len(),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Color<S> {
fn nsid() -> &'static str {
"place.stream.chat.profile"
}
fn def_name() -> &'static str {
"color"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_chat_profile()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.blue;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("blue"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.blue;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("blue"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.green;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("green"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.green;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("green"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.red;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("red"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.red;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("red"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ProfileRecord;
impl XrpcResp for ProfileRecord {
const NSID: &'static str = "place.stream.chat.profile";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ProfileGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<ProfileGetRecordOutput<S>> for Profile<S> {
fn from(output: ProfileGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Profile<S> {
const NSID: &'static str = "place.stream.chat.profile";
type Record = ProfileRecord;
}
impl Collection for ProfileRecord {
const NSID: &'static str = "place.stream.chat.profile";
type Record = ProfileRecord;
}
impl<S: BosStr> LexiconSchema for Profile<S> {
fn nsid() -> &'static str {
"place.stream.chat.profile"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_chat_profile()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.self_labels {
#[allow(unused_comparisons)]
if value.len() > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("self_labels"),
max: 10usize,
actual: value.len(),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for StreamerBadgeSelection<S> {
fn nsid() -> &'static str {
"place.stream.chat.profile"
}
fn def_name() -> &'static str {
"streamerBadgeSelection"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_chat_profile()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
fn lexicon_doc_place_stream_chat_profile() -> 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.chat.profile"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("badgeSelections"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Selected badges for display in chat, organized by slot.",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("global"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("streamer"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Selected streamer-issued badges, one per streamer channel.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#streamerBadgeSelection"),
..Default::default()
}),
max_length: Some(20usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("color"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Customizations for the color of a user's name in chat",
),
),
required: Some(
vec![
SmolStr::new_static("red"), SmolStr::new_static("green"),
SmolStr::new_static("blue")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blue"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("green"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("red"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"Record containing customizations for a user's chat profile.",
),
),
key: Some(CowStr::new_static("literal:self")),
record: LexRecordRecord::Object(LexObject {
required: Some(vec![]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("badges"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#badgeSelections"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("color"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#color"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("selfLabels"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Self-applied labels for this profile, e.g. 'bot'.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#selfLabel"),
..Default::default()
}),
max_length: Some(10usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("selfLabel"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static(
"Label that a user can apply to their own profile.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("streamerBadgeSelection"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A selected badge for a specific streamer's channel.",
),
),
required: Some(
vec![
SmolStr::new_static("streamer"), SmolStr::new_static("badge")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("badge"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("streamer"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"DID of the streamer whose channel this selection applies to.",
),
),
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod color_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 Blue;
type Green;
type Red;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Blue = Unset;
type Green = Unset;
type Red = Unset;
}
pub struct SetBlue<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBlue<St> {}
impl<St: State> State for SetBlue<St> {
type Blue = Set<members::blue>;
type Green = St::Green;
type Red = St::Red;
}
pub struct SetGreen<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetGreen<St> {}
impl<St: State> State for SetGreen<St> {
type Blue = St::Blue;
type Green = Set<members::green>;
type Red = St::Red;
}
pub struct SetRed<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRed<St> {}
impl<St: State> State for SetRed<St> {
type Blue = St::Blue;
type Green = St::Green;
type Red = Set<members::red>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct blue(());
pub struct green(());
pub struct red(());
}
}
pub struct ColorBuilder<St: color_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl Color<DefaultStr> {
pub fn new() -> ColorBuilder<color_state::Empty, DefaultStr> {
ColorBuilder::new()
}
}
impl<S: BosStr> Color<S> {
pub fn builder() -> ColorBuilder<color_state::Empty, S> {
ColorBuilder::builder()
}
}
impl ColorBuilder<color_state::Empty, DefaultStr> {
pub fn new() -> Self {
ColorBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ColorBuilder<color_state::Empty, S> {
pub fn builder() -> Self {
ColorBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorBuilder<St, S>
where
St: color_state::State,
St::Blue: color_state::IsUnset,
{
pub fn blue(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<color_state::SetBlue<St>, S> {
self._fields.0 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorBuilder<St, S>
where
St: color_state::State,
St::Green: color_state::IsUnset,
{
pub fn green(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<color_state::SetGreen<St>, S> {
self._fields.1 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorBuilder<St, S>
where
St: color_state::State,
St::Red: color_state::IsUnset,
{
pub fn red(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<color_state::SetRed<St>, S> {
self._fields.2 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ColorBuilder<St, S>
where
St: color_state::State,
St::Blue: color_state::IsSet,
St::Green: color_state::IsSet,
St::Red: color_state::IsSet,
{
pub fn build(self) -> Color<S> {
Color {
blue: self._fields.0.unwrap(),
green: self._fields.1.unwrap(),
red: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Color<S> {
Color {
blue: self._fields.0.unwrap(),
green: self._fields.1.unwrap(),
red: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod profile_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 {}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {}
#[allow(non_camel_case_types)]
pub mod members {}
}
pub struct ProfileBuilder<St: profile_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<profile::BadgeSelections<S>>,
Option<profile::Color<S>>,
Option<Vec<profile::SelfLabel<S>>>,
),
_type: PhantomData<fn() -> S>,
}
impl Profile<DefaultStr> {
pub fn new() -> ProfileBuilder<profile_state::Empty, DefaultStr> {
ProfileBuilder::new()
}
}
impl<S: BosStr> Profile<S> {
pub fn builder() -> ProfileBuilder<profile_state::Empty, S> {
ProfileBuilder::builder()
}
}
impl ProfileBuilder<profile_state::Empty, DefaultStr> {
pub fn new() -> Self {
ProfileBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ProfileBuilder<profile_state::Empty, S> {
pub fn builder() -> Self {
ProfileBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<St: profile_state::State, S: BosStr> ProfileBuilder<St, S> {
pub fn badges(
mut self,
value: impl Into<Option<profile::BadgeSelections<S>>>,
) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_badges(mut self, value: Option<profile::BadgeSelections<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<St: profile_state::State, S: BosStr> ProfileBuilder<St, S> {
pub fn color(mut self, value: impl Into<Option<profile::Color<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_color(mut self, value: Option<profile::Color<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: profile_state::State, S: BosStr> ProfileBuilder<St, S> {
pub fn self_labels(
mut self,
value: impl Into<Option<Vec<profile::SelfLabel<S>>>>,
) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_self_labels(
mut self,
value: Option<Vec<profile::SelfLabel<S>>>,
) -> Self {
self._fields.2 = value;
self
}
}
impl<St, S: BosStr> ProfileBuilder<St, S>
where
St: profile_state::State,
{
pub fn build(self) -> Profile<S> {
Profile {
badges: self._fields.0,
color: self._fields.1,
self_labels: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Profile<S> {
Profile {
badges: self._fields.0,
color: self._fields.1,
self_labels: self._fields.2,
extra_data: Some(extra_data),
}
}
}
pub mod streamer_badge_selection_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 Badge;
type Streamer;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Badge = Unset;
type Streamer = Unset;
}
pub struct SetBadge<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBadge<St> {}
impl<St: State> State for SetBadge<St> {
type Badge = Set<members::badge>;
type Streamer = St::Streamer;
}
pub struct SetStreamer<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStreamer<St> {}
impl<St: State> State for SetStreamer<St> {
type Badge = St::Badge;
type Streamer = Set<members::streamer>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct badge(());
pub struct streamer(());
}
}
pub struct StreamerBadgeSelectionBuilder<
St: streamer_badge_selection_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<StrongRef<S>>, Option<Did<S>>),
_type: PhantomData<fn() -> S>,
}
impl StreamerBadgeSelection<DefaultStr> {
pub fn new() -> StreamerBadgeSelectionBuilder<
streamer_badge_selection_state::Empty,
DefaultStr,
> {
StreamerBadgeSelectionBuilder::new()
}
}
impl<S: BosStr> StreamerBadgeSelection<S> {
pub fn builder() -> StreamerBadgeSelectionBuilder<
streamer_badge_selection_state::Empty,
S,
> {
StreamerBadgeSelectionBuilder::builder()
}
}
impl StreamerBadgeSelectionBuilder<streamer_badge_selection_state::Empty, DefaultStr> {
pub fn new() -> Self {
StreamerBadgeSelectionBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> StreamerBadgeSelectionBuilder<streamer_badge_selection_state::Empty, S> {
pub fn builder() -> Self {
StreamerBadgeSelectionBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StreamerBadgeSelectionBuilder<St, S>
where
St: streamer_badge_selection_state::State,
St::Badge: streamer_badge_selection_state::IsUnset,
{
pub fn badge(
mut self,
value: impl Into<StrongRef<S>>,
) -> StreamerBadgeSelectionBuilder<streamer_badge_selection_state::SetBadge<St>, S> {
self._fields.0 = Option::Some(value.into());
StreamerBadgeSelectionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StreamerBadgeSelectionBuilder<St, S>
where
St: streamer_badge_selection_state::State,
St::Streamer: streamer_badge_selection_state::IsUnset,
{
pub fn streamer(
mut self,
value: impl Into<Did<S>>,
) -> StreamerBadgeSelectionBuilder<
streamer_badge_selection_state::SetStreamer<St>,
S,
> {
self._fields.1 = Option::Some(value.into());
StreamerBadgeSelectionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> StreamerBadgeSelectionBuilder<St, S>
where
St: streamer_badge_selection_state::State,
St::Badge: streamer_badge_selection_state::IsSet,
St::Streamer: streamer_badge_selection_state::IsSet,
{
pub fn build(self) -> StreamerBadgeSelection<S> {
StreamerBadgeSelection {
badge: self._fields.0.unwrap(),
streamer: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> StreamerBadgeSelection<S> {
StreamerBadgeSelection {
badge: self._fields.0.unwrap(),
streamer: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}