pub mod get_services;
pub mod service;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{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, Nsid, Cid, Datetime};
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::app_bsky::actor::ProfileView;
use crate::com_atproto::label::Label;
use crate::com_atproto::label::LabelValue;
use crate::com_atproto::label::LabelValueDefinition;
use crate::com_atproto::moderation::ReasonType;
use crate::com_atproto::moderation::SubjectType;
use crate::app_bsky::labeler;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LabelerPolicies<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub label_value_definitions: Option<Vec<LabelValueDefinition<S>>>,
pub label_values: Vec<LabelValue<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 LabelerView<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
pub creator: ProfileView<S>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<Label<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer: Option<labeler::LabelerViewerState<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 LabelerViewDetailed<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
pub creator: ProfileView<S>,
pub indexed_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<Label<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub like_count: Option<i64>,
pub policies: labeler::LabelerPolicies<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reason_types: Option<Vec<ReasonType<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject_collections: Option<Vec<Nsid<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject_types: Option<Vec<SubjectType<S>>>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer: Option<labeler::LabelerViewerState<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, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LabelerViewerState<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub like: Option<AtUri<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for LabelerPolicies<S> {
fn nsid() -> &'static str {
"app.bsky.labeler.defs"
}
fn def_name() -> &'static str {
"labelerPolicies"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_labeler_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for LabelerView<S> {
fn nsid() -> &'static str {
"app.bsky.labeler.defs"
}
fn def_name() -> &'static str {
"labelerView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_labeler_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref 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 LabelerViewDetailed<S> {
fn nsid() -> &'static str {
"app.bsky.labeler.defs"
}
fn def_name() -> &'static str {
"labelerViewDetailed"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_labeler_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref 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 LabelerViewerState<S> {
fn nsid() -> &'static str {
"app.bsky.labeler.defs"
}
fn def_name() -> &'static str {
"labelerViewerState"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_labeler_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod labeler_policies_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 LabelValues;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type LabelValues = Unset;
}
pub struct SetLabelValues<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLabelValues<St> {}
impl<St: State> State for SetLabelValues<St> {
type LabelValues = Set<members::label_values>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct label_values(());
}
}
pub struct LabelerPoliciesBuilder<S: BosStr, St: labeler_policies_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Vec<LabelValueDefinition<S>>>, Option<Vec<LabelValue<S>>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> LabelerPolicies<S> {
pub fn new() -> LabelerPoliciesBuilder<S, labeler_policies_state::Empty> {
LabelerPoliciesBuilder::new()
}
}
impl<S: BosStr> LabelerPoliciesBuilder<S, labeler_policies_state::Empty> {
pub fn new() -> Self {
LabelerPoliciesBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: labeler_policies_state::State> LabelerPoliciesBuilder<S, St> {
pub fn label_value_definitions(
mut self,
value: impl Into<Option<Vec<LabelValueDefinition<S>>>>,
) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_label_value_definitions(
mut self,
value: Option<Vec<LabelValueDefinition<S>>>,
) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> LabelerPoliciesBuilder<S, St>
where
St: labeler_policies_state::State,
St::LabelValues: labeler_policies_state::IsUnset,
{
pub fn label_values(
mut self,
value: impl Into<Vec<LabelValue<S>>>,
) -> LabelerPoliciesBuilder<S, labeler_policies_state::SetLabelValues<St>> {
self._fields.1 = Option::Some(value.into());
LabelerPoliciesBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerPoliciesBuilder<S, St>
where
St: labeler_policies_state::State,
St::LabelValues: labeler_policies_state::IsSet,
{
pub fn build(self) -> LabelerPolicies<S> {
LabelerPolicies {
label_value_definitions: self._fields.0,
label_values: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> LabelerPolicies<S> {
LabelerPolicies {
label_value_definitions: self._fields.0,
label_values: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_labeler_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("app.bsky.labeler.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("labelerPolicies"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("labelValues")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("labelValueDefinitions"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"com.atproto.label.defs#labelValueDefinition",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labelValues"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"The label values which this labeler publishes. May include global or custom labels.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"com.atproto.label.defs#labelValue",
),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labelerView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("creator"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("creator"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileView",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labels"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.label.defs#label"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewer"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#labelerViewerState"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labelerViewDetailed"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("creator"),
SmolStr::new_static("policies"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("creator"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileView",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labels"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.label.defs#label"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likeCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("policies"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.labeler.defs#labelerPolicies",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reasonTypes"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"com.atproto.moderation.defs#reasonType",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subjectCollections"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.",
),
),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::Nsid),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subjectTypes"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"The set of subject types (account, record, etc) this service accepts reports on.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"com.atproto.moderation.defs#subjectType",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viewer"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#labelerViewerState"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labelerViewerState"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("like"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod labeler_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 Uri;
type IndexedAt;
type Creator;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type IndexedAt = Unset;
type Creator = Unset;
type Cid = 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>;
type IndexedAt = St::IndexedAt;
type Creator = St::Creator;
type Cid = St::Cid;
}
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 Uri = St::Uri;
type IndexedAt = Set<members::indexed_at>;
type Creator = St::Creator;
type Cid = St::Cid;
}
pub struct SetCreator<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreator<St> {}
impl<St: State> State for SetCreator<St> {
type Uri = St::Uri;
type IndexedAt = St::IndexedAt;
type Creator = Set<members::creator>;
type Cid = St::Cid;
}
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 Uri = St::Uri;
type IndexedAt = St::IndexedAt;
type Creator = St::Creator;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct indexed_at(());
pub struct creator(());
pub struct cid(());
}
}
pub struct LabelerViewBuilder<S: BosStr, St: labeler_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Cid<S>>,
Option<ProfileView<S>>,
Option<Datetime>,
Option<Vec<Label<S>>>,
Option<i64>,
Option<AtUri<S>>,
Option<labeler::LabelerViewerState<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> LabelerView<S> {
pub fn new() -> LabelerViewBuilder<S, labeler_view_state::Empty> {
LabelerViewBuilder::new()
}
}
impl<S: BosStr> LabelerViewBuilder<S, labeler_view_state::Empty> {
pub fn new() -> Self {
LabelerViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerViewBuilder<S, St>
where
St: labeler_view_state::State,
St::Cid: labeler_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> LabelerViewBuilder<S, labeler_view_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
LabelerViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerViewBuilder<S, St>
where
St: labeler_view_state::State,
St::Creator: labeler_view_state::IsUnset,
{
pub fn creator(
mut self,
value: impl Into<ProfileView<S>>,
) -> LabelerViewBuilder<S, labeler_view_state::SetCreator<St>> {
self._fields.1 = Option::Some(value.into());
LabelerViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerViewBuilder<S, St>
where
St: labeler_view_state::State,
St::IndexedAt: labeler_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> LabelerViewBuilder<S, labeler_view_state::SetIndexedAt<St>> {
self._fields.2 = Option::Some(value.into());
LabelerViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: labeler_view_state::State> LabelerViewBuilder<S, St> {
pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St: labeler_view_state::State> LabelerViewBuilder<S, St> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St> LabelerViewBuilder<S, St>
where
St: labeler_view_state::State,
St::Uri: labeler_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> LabelerViewBuilder<S, labeler_view_state::SetUri<St>> {
self._fields.5 = Option::Some(value.into());
LabelerViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: labeler_view_state::State> LabelerViewBuilder<S, St> {
pub fn viewer(
mut self,
value: impl Into<Option<labeler::LabelerViewerState<S>>>,
) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_viewer(
mut self,
value: Option<labeler::LabelerViewerState<S>>,
) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> LabelerViewBuilder<S, St>
where
St: labeler_view_state::State,
St::Uri: labeler_view_state::IsSet,
St::IndexedAt: labeler_view_state::IsSet,
St::Creator: labeler_view_state::IsSet,
St::Cid: labeler_view_state::IsSet,
{
pub fn build(self) -> LabelerView<S> {
LabelerView {
cid: self._fields.0.unwrap(),
creator: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
labels: self._fields.3,
like_count: self._fields.4,
uri: self._fields.5.unwrap(),
viewer: self._fields.6,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> LabelerView<S> {
LabelerView {
cid: self._fields.0.unwrap(),
creator: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
labels: self._fields.3,
like_count: self._fields.4,
uri: self._fields.5.unwrap(),
viewer: self._fields.6,
extra_data: Some(extra_data),
}
}
}
pub mod labeler_view_detailed_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 Policies;
type Uri;
type Cid;
type Creator;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Policies = Unset;
type Uri = Unset;
type Cid = Unset;
type Creator = Unset;
type IndexedAt = Unset;
}
pub struct SetPolicies<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPolicies<St> {}
impl<St: State> State for SetPolicies<St> {
type Policies = Set<members::policies>;
type Uri = St::Uri;
type Cid = St::Cid;
type Creator = St::Creator;
type IndexedAt = St::IndexedAt;
}
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 Policies = St::Policies;
type Uri = Set<members::uri>;
type Cid = St::Cid;
type Creator = St::Creator;
type IndexedAt = St::IndexedAt;
}
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 Policies = St::Policies;
type Uri = St::Uri;
type Cid = Set<members::cid>;
type Creator = St::Creator;
type IndexedAt = St::IndexedAt;
}
pub struct SetCreator<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreator<St> {}
impl<St: State> State for SetCreator<St> {
type Policies = St::Policies;
type Uri = St::Uri;
type Cid = St::Cid;
type Creator = Set<members::creator>;
type IndexedAt = St::IndexedAt;
}
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 Policies = St::Policies;
type Uri = St::Uri;
type Cid = St::Cid;
type Creator = St::Creator;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct policies(());
pub struct uri(());
pub struct cid(());
pub struct creator(());
pub struct indexed_at(());
}
}
pub struct LabelerViewDetailedBuilder<
S: BosStr,
St: labeler_view_detailed_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Cid<S>>,
Option<ProfileView<S>>,
Option<Datetime>,
Option<Vec<Label<S>>>,
Option<i64>,
Option<labeler::LabelerPolicies<S>>,
Option<Vec<ReasonType<S>>>,
Option<Vec<Nsid<S>>>,
Option<Vec<SubjectType<S>>>,
Option<AtUri<S>>,
Option<labeler::LabelerViewerState<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> LabelerViewDetailed<S> {
pub fn new() -> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::Empty> {
LabelerViewDetailedBuilder::new()
}
}
impl<S: BosStr> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::Empty> {
pub fn new() -> Self {
LabelerViewDetailedBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerViewDetailedBuilder<S, St>
where
St: labeler_view_detailed_state::State,
St::Cid: labeler_view_detailed_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
LabelerViewDetailedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerViewDetailedBuilder<S, St>
where
St: labeler_view_detailed_state::State,
St::Creator: labeler_view_detailed_state::IsUnset,
{
pub fn creator(
mut self,
value: impl Into<ProfileView<S>>,
) -> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::SetCreator<St>> {
self._fields.1 = Option::Some(value.into());
LabelerViewDetailedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LabelerViewDetailedBuilder<S, St>
where
St: labeler_view_detailed_state::State,
St::IndexedAt: labeler_view_detailed_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::SetIndexedAt<St>> {
self._fields.2 = Option::Some(value.into());
LabelerViewDetailedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: labeler_view_detailed_state::State,
> LabelerViewDetailedBuilder<S, St> {
pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
self._fields.3 = value;
self
}
}
impl<
S: BosStr,
St: labeler_view_detailed_state::State,
> LabelerViewDetailedBuilder<S, St> {
pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St> LabelerViewDetailedBuilder<S, St>
where
St: labeler_view_detailed_state::State,
St::Policies: labeler_view_detailed_state::IsUnset,
{
pub fn policies(
mut self,
value: impl Into<labeler::LabelerPolicies<S>>,
) -> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::SetPolicies<St>> {
self._fields.5 = Option::Some(value.into());
LabelerViewDetailedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: labeler_view_detailed_state::State,
> LabelerViewDetailedBuilder<S, St> {
pub fn reason_types(mut self, value: impl Into<Option<Vec<ReasonType<S>>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_reason_types(mut self, value: Option<Vec<ReasonType<S>>>) -> Self {
self._fields.6 = value;
self
}
}
impl<
S: BosStr,
St: labeler_view_detailed_state::State,
> LabelerViewDetailedBuilder<S, St> {
pub fn subject_collections(
mut self,
value: impl Into<Option<Vec<Nsid<S>>>>,
) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_subject_collections(mut self, value: Option<Vec<Nsid<S>>>) -> Self {
self._fields.7 = value;
self
}
}
impl<
S: BosStr,
St: labeler_view_detailed_state::State,
> LabelerViewDetailedBuilder<S, St> {
pub fn subject_types(
mut self,
value: impl Into<Option<Vec<SubjectType<S>>>>,
) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_subject_types(mut self, value: Option<Vec<SubjectType<S>>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St> LabelerViewDetailedBuilder<S, St>
where
St: labeler_view_detailed_state::State,
St::Uri: labeler_view_detailed_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> LabelerViewDetailedBuilder<S, labeler_view_detailed_state::SetUri<St>> {
self._fields.9 = Option::Some(value.into());
LabelerViewDetailedBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: labeler_view_detailed_state::State,
> LabelerViewDetailedBuilder<S, St> {
pub fn viewer(
mut self,
value: impl Into<Option<labeler::LabelerViewerState<S>>>,
) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_viewer(
mut self,
value: Option<labeler::LabelerViewerState<S>>,
) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St> LabelerViewDetailedBuilder<S, St>
where
St: labeler_view_detailed_state::State,
St::Policies: labeler_view_detailed_state::IsSet,
St::Uri: labeler_view_detailed_state::IsSet,
St::Cid: labeler_view_detailed_state::IsSet,
St::Creator: labeler_view_detailed_state::IsSet,
St::IndexedAt: labeler_view_detailed_state::IsSet,
{
pub fn build(self) -> LabelerViewDetailed<S> {
LabelerViewDetailed {
cid: self._fields.0.unwrap(),
creator: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
labels: self._fields.3,
like_count: self._fields.4,
policies: self._fields.5.unwrap(),
reason_types: self._fields.6,
subject_collections: self._fields.7,
subject_types: self._fields.8,
uri: self._fields.9.unwrap(),
viewer: self._fields.10,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> LabelerViewDetailed<S> {
LabelerViewDetailed {
cid: self._fields.0.unwrap(),
creator: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
labels: self._fields.3,
like_count: self._fields.4,
policies: self._fields.5.unwrap(),
reason_types: self._fields.6,
subject_collections: self._fields.7,
subject_types: self._fields.8,
uri: self._fields.9.unwrap(),
viewer: self._fields.10,
extra_data: Some(extra_data),
}
}
}