#[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::string::{AtUri, Cid};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, 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::place_stream::media::track::TrackView;
use crate::place_stream::media::get_video;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetVideo<S: BosStr = DefaultStr> {
pub uri: AtUri<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetVideoOutput<S: BosStr = DefaultStr> {
#[serde(flatten)]
pub value: Data<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,
thiserror::Error,
miette::Diagnostic
)]
#[serde(tag = "error", content = "message")]
pub enum GetVideoError {
#[serde(rename = "VideoNotFound")]
VideoNotFound(Option<SmolStr>),
#[serde(untagged)]
Other { error: SmolStr, message: Option<SmolStr> },
}
impl core::fmt::Display for GetVideoError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::VideoNotFound(msg) => {
write!(f, "VideoNotFound")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::Other { error, message } => {
write!(f, "{}", error)?;
if let Some(msg) = message {
write!(f, ": {}", msg)?;
}
Ok(())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct VideoView<S: BosStr = DefaultStr> {
pub author: ProfileViewBasic<S>,
pub cid: Cid<S>,
pub like_count: i64,
pub record: Data<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tracks: Option<Vec<TrackView<S>>>,
pub uri: AtUri<S>,
pub view_counts: get_video::ViewCountSummary<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 ViewCountSummary<S: BosStr = DefaultStr> {
pub bytes: i64,
pub count: i64,
pub duration_ms: i64,
pub reporters: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetVideoResponse;
impl jacquard_common::xrpc::XrpcResp for GetVideoResponse {
const NSID: &'static str = "place.stream.media.getVideo";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetVideoOutput<S>;
type Err = GetVideoError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetVideo<S> {
const NSID: &'static str = "place.stream.media.getVideo";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetVideoResponse;
}
pub struct GetVideoRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetVideoRequest {
const PATH: &'static str = "/xrpc/place.stream.media.getVideo";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetVideo<S>;
type Response = GetVideoResponse;
}
impl<S: BosStr> LexiconSchema for VideoView<S> {
fn nsid() -> &'static str {
"place.stream.media.getVideo"
}
fn def_name() -> &'static str {
"videoView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_media_getVideo()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.like_count;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("like_count"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ViewCountSummary<S> {
fn nsid() -> &'static str {
"place.stream.media.getVideo"
}
fn def_name() -> &'static str {
"viewCountSummary"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_media_getVideo()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.bytes;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("bytes"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.count;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("count"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.duration_ms;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("duration_ms"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.reporters;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("reporters"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
pub mod get_video_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 Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
}
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 Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct GetVideoBuilder<St: get_video_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl GetVideo<DefaultStr> {
pub fn new() -> GetVideoBuilder<get_video_state::Empty, DefaultStr> {
GetVideoBuilder::new()
}
}
impl<S: BosStr> GetVideo<S> {
pub fn builder() -> GetVideoBuilder<get_video_state::Empty, S> {
GetVideoBuilder::builder()
}
}
impl GetVideoBuilder<get_video_state::Empty, DefaultStr> {
pub fn new() -> Self {
GetVideoBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr> GetVideoBuilder<get_video_state::Empty, S> {
pub fn builder() -> Self {
GetVideoBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> GetVideoBuilder<St, S>
where
St: get_video_state::State,
St::Uri: get_video_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> GetVideoBuilder<get_video_state::SetUri<St>, S> {
self._fields.0 = Option::Some(value.into());
GetVideoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> GetVideoBuilder<St, S>
where
St: get_video_state::State,
St::Uri: get_video_state::IsSet,
{
pub fn build(self) -> GetVideo<S> {
GetVideo {
uri: self._fields.0.unwrap(),
}
}
}
pub mod video_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 Cid;
type LikeCount;
type Record;
type Uri;
type ViewCounts;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Author = Unset;
type Cid = Unset;
type LikeCount = Unset;
type Record = Unset;
type Uri = Unset;
type ViewCounts = 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 Cid = St::Cid;
type LikeCount = St::LikeCount;
type Record = St::Record;
type Uri = St::Uri;
type ViewCounts = St::ViewCounts;
}
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 Author = St::Author;
type Cid = Set<members::cid>;
type LikeCount = St::LikeCount;
type Record = St::Record;
type Uri = St::Uri;
type ViewCounts = St::ViewCounts;
}
pub struct SetLikeCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLikeCount<St> {}
impl<St: State> State for SetLikeCount<St> {
type Author = St::Author;
type Cid = St::Cid;
type LikeCount = Set<members::like_count>;
type Record = St::Record;
type Uri = St::Uri;
type ViewCounts = St::ViewCounts;
}
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 Author = St::Author;
type Cid = St::Cid;
type LikeCount = St::LikeCount;
type Record = Set<members::record>;
type Uri = St::Uri;
type ViewCounts = St::ViewCounts;
}
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 Cid = St::Cid;
type LikeCount = St::LikeCount;
type Record = St::Record;
type Uri = Set<members::uri>;
type ViewCounts = St::ViewCounts;
}
pub struct SetViewCounts<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetViewCounts<St> {}
impl<St: State> State for SetViewCounts<St> {
type Author = St::Author;
type Cid = St::Cid;
type LikeCount = St::LikeCount;
type Record = St::Record;
type Uri = St::Uri;
type ViewCounts = Set<members::view_counts>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct author(());
pub struct cid(());
pub struct like_count(());
pub struct record(());
pub struct uri(());
pub struct view_counts(());
}
}
pub struct VideoViewBuilder<St: video_view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<ProfileViewBasic<S>>,
Option<Cid<S>>,
Option<i64>,
Option<Data<S>>,
Option<Vec<TrackView<S>>>,
Option<AtUri<S>>,
Option<get_video::ViewCountSummary<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl VideoView<DefaultStr> {
pub fn new() -> VideoViewBuilder<video_view_state::Empty, DefaultStr> {
VideoViewBuilder::new()
}
}
impl<S: BosStr> VideoView<S> {
pub fn builder() -> VideoViewBuilder<video_view_state::Empty, S> {
VideoViewBuilder::builder()
}
}
impl VideoViewBuilder<video_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
VideoViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> VideoViewBuilder<video_view_state::Empty, S> {
pub fn builder() -> Self {
VideoViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::Author: video_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> VideoViewBuilder<video_view_state::SetAuthor<St>, S> {
self._fields.0 = Option::Some(value.into());
VideoViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::Cid: video_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> VideoViewBuilder<video_view_state::SetCid<St>, S> {
self._fields.1 = Option::Some(value.into());
VideoViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::LikeCount: video_view_state::IsUnset,
{
pub fn like_count(
mut self,
value: impl Into<i64>,
) -> VideoViewBuilder<video_view_state::SetLikeCount<St>, S> {
self._fields.2 = Option::Some(value.into());
VideoViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::Record: video_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Data<S>>,
) -> VideoViewBuilder<video_view_state::SetRecord<St>, S> {
self._fields.3 = Option::Some(value.into());
VideoViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: video_view_state::State, S: BosStr> VideoViewBuilder<St, S> {
pub fn tracks(mut self, value: impl Into<Option<Vec<TrackView<S>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_tracks(mut self, value: Option<Vec<TrackView<S>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::Uri: video_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> VideoViewBuilder<video_view_state::SetUri<St>, S> {
self._fields.5 = Option::Some(value.into());
VideoViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::ViewCounts: video_view_state::IsUnset,
{
pub fn view_counts(
mut self,
value: impl Into<get_video::ViewCountSummary<S>>,
) -> VideoViewBuilder<video_view_state::SetViewCounts<St>, S> {
self._fields.6 = Option::Some(value.into());
VideoViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VideoViewBuilder<St, S>
where
St: video_view_state::State,
St::Author: video_view_state::IsSet,
St::Cid: video_view_state::IsSet,
St::LikeCount: video_view_state::IsSet,
St::Record: video_view_state::IsSet,
St::Uri: video_view_state::IsSet,
St::ViewCounts: video_view_state::IsSet,
{
pub fn build(self) -> VideoView<S> {
VideoView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
like_count: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
tracks: self._fields.4,
uri: self._fields.5.unwrap(),
view_counts: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> VideoView<S> {
VideoView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
like_count: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
tracks: self._fields.4,
uri: self._fields.5.unwrap(),
view_counts: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_place_stream_media_getVideo() -> 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.media.getVideo"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(
LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![SmolStr::new_static("uri")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("uri"),
LexXrpcParametersProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI of the place.stream.video record.",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("videoView"),
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("viewCounts"),
SmolStr::new_static("likeCount")
],
),
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("likeCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tracks"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"place.stream.media.track#trackView",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewCounts"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#viewCountSummary"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewCountSummary"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Sums across every place.stream.media.viewCount record indexed for this video, regardless of reporter or window. The underlying records are window-bounded; the consumer sees a running total.",
),
),
required: Some(
vec![
SmolStr::new_static("count"), SmolStr::new_static("bytes"),
SmolStr::new_static("durationMs"),
SmolStr::new_static("reporters")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bytes"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("count"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("durationMs"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reporters"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod view_count_summary_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 Bytes;
type Count;
type DurationMs;
type Reporters;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Bytes = Unset;
type Count = Unset;
type DurationMs = Unset;
type Reporters = Unset;
}
pub struct SetBytes<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBytes<St> {}
impl<St: State> State for SetBytes<St> {
type Bytes = Set<members::bytes>;
type Count = St::Count;
type DurationMs = St::DurationMs;
type Reporters = St::Reporters;
}
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 Bytes = St::Bytes;
type Count = Set<members::count>;
type DurationMs = St::DurationMs;
type Reporters = St::Reporters;
}
pub struct SetDurationMs<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDurationMs<St> {}
impl<St: State> State for SetDurationMs<St> {
type Bytes = St::Bytes;
type Count = St::Count;
type DurationMs = Set<members::duration_ms>;
type Reporters = St::Reporters;
}
pub struct SetReporters<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReporters<St> {}
impl<St: State> State for SetReporters<St> {
type Bytes = St::Bytes;
type Count = St::Count;
type DurationMs = St::DurationMs;
type Reporters = Set<members::reporters>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct bytes(());
pub struct count(());
pub struct duration_ms(());
pub struct reporters(());
}
}
pub struct ViewCountSummaryBuilder<
St: view_count_summary_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<i64>, Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl ViewCountSummary<DefaultStr> {
pub fn new() -> ViewCountSummaryBuilder<
view_count_summary_state::Empty,
DefaultStr,
> {
ViewCountSummaryBuilder::new()
}
}
impl<S: BosStr> ViewCountSummary<S> {
pub fn builder() -> ViewCountSummaryBuilder<view_count_summary_state::Empty, S> {
ViewCountSummaryBuilder::builder()
}
}
impl ViewCountSummaryBuilder<view_count_summary_state::Empty, DefaultStr> {
pub fn new() -> Self {
ViewCountSummaryBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ViewCountSummaryBuilder<view_count_summary_state::Empty, S> {
pub fn builder() -> Self {
ViewCountSummaryBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewCountSummaryBuilder<St, S>
where
St: view_count_summary_state::State,
St::Bytes: view_count_summary_state::IsUnset,
{
pub fn bytes(
mut self,
value: impl Into<i64>,
) -> ViewCountSummaryBuilder<view_count_summary_state::SetBytes<St>, S> {
self._fields.0 = Option::Some(value.into());
ViewCountSummaryBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewCountSummaryBuilder<St, S>
where
St: view_count_summary_state::State,
St::Count: view_count_summary_state::IsUnset,
{
pub fn count(
mut self,
value: impl Into<i64>,
) -> ViewCountSummaryBuilder<view_count_summary_state::SetCount<St>, S> {
self._fields.1 = Option::Some(value.into());
ViewCountSummaryBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewCountSummaryBuilder<St, S>
where
St: view_count_summary_state::State,
St::DurationMs: view_count_summary_state::IsUnset,
{
pub fn duration_ms(
mut self,
value: impl Into<i64>,
) -> ViewCountSummaryBuilder<view_count_summary_state::SetDurationMs<St>, S> {
self._fields.2 = Option::Some(value.into());
ViewCountSummaryBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewCountSummaryBuilder<St, S>
where
St: view_count_summary_state::State,
St::Reporters: view_count_summary_state::IsUnset,
{
pub fn reporters(
mut self,
value: impl Into<i64>,
) -> ViewCountSummaryBuilder<view_count_summary_state::SetReporters<St>, S> {
self._fields.3 = Option::Some(value.into());
ViewCountSummaryBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ViewCountSummaryBuilder<St, S>
where
St: view_count_summary_state::State,
St::Bytes: view_count_summary_state::IsSet,
St::Count: view_count_summary_state::IsSet,
St::DurationMs: view_count_summary_state::IsSet,
St::Reporters: view_count_summary_state::IsSet,
{
pub fn build(self) -> ViewCountSummary<S> {
ViewCountSummary {
bytes: self._fields.0.unwrap(),
count: self._fields.1.unwrap(),
duration_ms: self._fields.2.unwrap(),
reporters: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ViewCountSummary<S> {
ViewCountSummary {
bytes: self._fields.0.unwrap(),
count: self._fields.1.unwrap(),
duration_ms: self._fields.2.unwrap(),
reporters: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}