Something went wrong. Try again.
atproto made easy crates.io/crates/jacquard
atproto rust
Something went wrong. Try again.
46 kB · 1305 lines
Rust
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: tools.ozone.queue.defs//// This file was automatically generated from Lexicon schemas.// Any manual changes will be overwritten on the next regeneration.
//! Generated bindings for the `tools.ozone.queue` Lexicon namespace/module.pub mod assign_moderator;pub mod create_queue;pub mod delete_queue;pub mod get_assignments;pub mod list_queues;pub mod route_reports;pub mod unassign_moderator;pub mod update_queue;
#[allow(unused_imports)]use alloc::collections::BTreeMap;
#[allow(unused_imports)]use core::marker::PhantomData;use jacquard_common::{BosStr, CowStr, 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::{Datetime, Did, Nsid};use jacquard_common::types::value::Data;use jacquard_derive::IntoStatic;use jacquard_lexicon::lexicon::LexiconDoc;use jacquard_lexicon::schema::LexiconSchema;
use crate::tools_ozone::queue;use crate::tools_ozone::team::Member;#[allow(unused_imports)]use jacquard_lexicon::validation::{ConstraintError, ValidationPath};use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct AssignmentView<S: BosStr = DefaultStr> { pub did: Did<S>, #[serde(skip_serializing_if = "Option::is_none")] pub end_at: Option<Datetime>, pub id: i64, /// The moderator assigned to this queue #[serde(skip_serializing_if = "Option::is_none")] pub moderator: Option<Member<S>>, pub queue: queue::QueueView<S>, pub start_at: Datetime, #[serde( flatten, default, deserialize_with = "deserialize_assignment_view_extra_data", 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 QueueStats<S: BosStr = DefaultStr> { /// Percentage of reports actioned (actionedCount / inboundCount * 100), rounded to nearest integer. Absent when inboundCount is 0. #[serde(skip_serializing_if = "Option::is_none")] pub action_rate: Option<i64>, /// Number of reports in 'closed' status #[serde(skip_serializing_if = "Option::is_none")] pub actioned_count: Option<i64>, /// Average time in seconds from report creation to close, for reports closed in this period. #[serde(skip_serializing_if = "Option::is_none")] pub avg_handling_time_sec: Option<i64>, /// Number of reports in 'escalated' status #[serde(skip_serializing_if = "Option::is_none")] pub escalated_count: Option<i64>, /// Reports received in this queue in the last 24 hours. #[serde(skip_serializing_if = "Option::is_none")] pub inbound_count: Option<i64>, /// When these statistics were last computed #[serde(skip_serializing_if = "Option::is_none")] pub last_updated: Option<Datetime>, /// Number of reports in 'open' status #[serde(skip_serializing_if = "Option::is_none")] pub pending_count: Option<i64>, #[serde( flatten, default, deserialize_with = "deserialize_queue_stats_extra_data", 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 QueueView<S: BosStr = DefaultStr> { /// Collection name for record subjects (e.g., 'app.bsky.feed.post') #[serde(skip_serializing_if = "Option::is_none")] pub collection: Option<Nsid<S>>, pub created_at: Datetime, /// DID of moderator who created this queue pub created_by: Did<S>, /// When the queue was deleted, if applicable #[serde(skip_serializing_if = "Option::is_none")] pub deleted_at: Option<Datetime>, /// Optional description of the queue #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<S>, /// Whether this queue is currently active pub enabled: bool, /// Queue ID pub id: i64, /// Display name of the queue pub name: S, /// Policy keys recommended when actioning reports in this queue #[serde(skip_serializing_if = "Option::is_none")] pub recommended_policies: Option<Vec<S>>, /// Report reason types this queue accepts (fully qualified NSIDs) #[serde(skip_serializing_if = "Option::is_none")] pub report_types: Option<Vec<S>>, /// Statistics about this queue pub stats: queue::QueueStats<S>, /// Subject types this queue accepts. #[serde(skip_serializing_if = "Option::is_none")] pub subject_types: Option<Vec<QueueViewSubjectTypes<S>>>, pub updated_at: Datetime, #[serde( flatten, default, deserialize_with = "deserialize_queue_view_extra_data", skip_serializing_if = "Option::is_none" )] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum QueueViewSubjectTypes<S: BosStr = DefaultStr> { Account, Record, Message, Conversation, Other(S),}
impl<S: BosStr> QueueViewSubjectTypes<S> { pub fn as_str(&self) -> &str { match self { Self::Account => "account", Self::Record => "record", Self::Message => "message", Self::Conversation => "conversation", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "account" => Self::Account, "record" => Self::Record, "message" => Self::Message, "conversation" => Self::Conversation, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for QueueViewSubjectTypes<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for QueueViewSubjectTypes<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for QueueViewSubjectTypes<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 QueueViewSubjectTypes<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 + Default> Default for QueueViewSubjectTypes<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for QueueViewSubjectTypes<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = QueueViewSubjectTypes<S::Output>; fn into_static(self) -> Self::Output { match self { QueueViewSubjectTypes::Account => QueueViewSubjectTypes::Account, QueueViewSubjectTypes::Record => QueueViewSubjectTypes::Record, QueueViewSubjectTypes::Message => QueueViewSubjectTypes::Message, QueueViewSubjectTypes::Conversation => QueueViewSubjectTypes::Conversation, QueueViewSubjectTypes::Other(v) => QueueViewSubjectTypes::Other(v.into_static()), } }}
impl<S: BosStr> LexiconSchema for AssignmentView<S> { fn nsid() -> &'static str { "tools.ozone.queue.defs" } fn def_name() -> &'static str { "assignmentView" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_tools_ozone_queue_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
impl<S: BosStr> LexiconSchema for QueueStats<S> { fn nsid() -> &'static str { "tools.ozone.queue.defs" } fn def_name() -> &'static str { "queueStats" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_tools_ozone_queue_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
impl<S: BosStr> LexiconSchema for QueueView<S> { fn nsid() -> &'static str { "tools.ozone.queue.defs" } fn def_name() -> &'static str { "queueView" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_tools_ozone_queue_defs() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
fn deserialize_assignment_view_extra_data<'de, S, D>( deserializer: D,) -> Result<Option<BTreeMap<SmolStr, Data<S>>>, D::Error>where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>,{ let data = <Option<BTreeMap<SmolStr, Data<S>>> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty()))}
pub mod assignment_view_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; type Id; type Queue; type StartAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; type Id = Unset; type Queue = Unset; type StartAt = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetDid<St> {} impl<St: State> State for SetDid<St> { type Did = Set<members::did>; type Id = St::Id; type Queue = St::Queue; type StartAt = St::StartAt; } ///State transition - sets the `id` field to Set pub struct SetId<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetId<St> {} impl<St: State> State for SetId<St> { type Did = St::Did; type Id = Set<members::id>; type Queue = St::Queue; type StartAt = St::StartAt; } ///State transition - sets the `queue` field to Set pub struct SetQueue<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetQueue<St> {} impl<St: State> State for SetQueue<St> { type Did = St::Did; type Id = St::Id; type Queue = Set<members::queue>; type StartAt = St::StartAt; } ///State transition - sets the `start_at` field to Set pub struct SetStartAt<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetStartAt<St> {} impl<St: State> State for SetStartAt<St> { type Did = St::Did; type Id = St::Id; type Queue = St::Queue; type StartAt = Set<members::start_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `queue` field pub struct queue(()); ///Marker type for the `start_at` field pub struct start_at(()); }}
/// Builder for constructing an instance of this type.pub struct AssignmentViewBuilder<St: assignment_view_state::State, S: BosStr = DefaultStr> { _state: PhantomData<fn() -> St>, _fields: ( Option<Did<S>>, Option<Datetime>, Option<i64>, Option<Member<S>>, Option<queue::QueueView<S>>, Option<Datetime>, ), _type: PhantomData<fn() -> S>,}
impl AssignmentView<DefaultStr> { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> AssignmentViewBuilder<assignment_view_state::Empty, DefaultStr> { AssignmentViewBuilder::new() }}
impl<S: BosStr> AssignmentView<S> { /// Create a new builder for this type pub fn builder() -> AssignmentViewBuilder<assignment_view_state::Empty, S> { AssignmentViewBuilder::builder() }}
impl AssignmentViewBuilder<assignment_view_state::Empty, DefaultStr> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { AssignmentViewBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } }}
impl<S: BosStr> AssignmentViewBuilder<assignment_view_state::Empty, S> { /// Create a new builder with all fields unset pub fn builder() -> Self { AssignmentViewBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None), _type: PhantomData, } }}
impl<St, S: BosStr> AssignmentViewBuilder<St, S>where St: assignment_view_state::State, St::Did: assignment_view_state::IsUnset,{ /// Set the `did` field (required) pub fn did( mut self, value: impl Into<Did<S>>, ) -> AssignmentViewBuilder<assignment_view_state::SetDid<St>, S> { self._fields.0 = Option::Some(value.into()); AssignmentViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St: assignment_view_state::State, S: BosStr> AssignmentViewBuilder<St, S> { /// Set the `endAt` field (optional) pub fn end_at(mut self, value: impl Into<Option<Datetime>>) -> Self { self._fields.1 = value.into(); self } /// Set the `endAt` field to an Option value (optional) pub fn maybe_end_at(mut self, value: Option<Datetime>) -> Self { self._fields.1 = value; self }}
impl<St, S: BosStr> AssignmentViewBuilder<St, S>where St: assignment_view_state::State, St::Id: assignment_view_state::IsUnset,{ /// Set the `id` field (required) pub fn id( mut self, value: impl Into<i64>, ) -> AssignmentViewBuilder<assignment_view_state::SetId<St>, S> { self._fields.2 = Option::Some(value.into()); AssignmentViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St: assignment_view_state::State, S: BosStr> AssignmentViewBuilder<St, S> { /// Set the `moderator` field (optional) pub fn moderator(mut self, value: impl Into<Option<Member<S>>>) -> Self { self._fields.3 = value.into(); self } /// Set the `moderator` field to an Option value (optional) pub fn maybe_moderator(mut self, value: Option<Member<S>>) -> Self { self._fields.3 = value; self }}
impl<St, S: BosStr> AssignmentViewBuilder<St, S>where St: assignment_view_state::State, St::Queue: assignment_view_state::IsUnset,{ /// Set the `queue` field (required) pub fn queue( mut self, value: impl Into<queue::QueueView<S>>, ) -> AssignmentViewBuilder<assignment_view_state::SetQueue<St>, S> { self._fields.4 = Option::Some(value.into()); AssignmentViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> AssignmentViewBuilder<St, S>where St: assignment_view_state::State, St::StartAt: assignment_view_state::IsUnset,{ /// Set the `startAt` field (required) pub fn start_at( mut self, value: impl Into<Datetime>, ) -> AssignmentViewBuilder<assignment_view_state::SetStartAt<St>, S> { self._fields.5 = Option::Some(value.into()); AssignmentViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> AssignmentViewBuilder<St, S>where St: assignment_view_state::State, St::Did: assignment_view_state::IsSet, St::Id: assignment_view_state::IsSet, St::Queue: assignment_view_state::IsSet, St::StartAt: assignment_view_state::IsSet,{ /// Build the final struct. pub fn build(self) -> AssignmentView<S> { AssignmentView { did: self._fields.0.unwrap(), end_at: self._fields.1, id: self._fields.2.unwrap(), moderator: self._fields.3, queue: self._fields.4.unwrap(), start_at: self._fields.5.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> AssignmentView<S> { AssignmentView { did: self._fields.0.unwrap(), end_at: self._fields.1, id: self._fields.2.unwrap(), moderator: self._fields.3, queue: self._fields.4.unwrap(), start_at: self._fields.5.unwrap(), extra_data: Some(extra_data), } }}
fn lexicon_doc_tools_ozone_queue_defs() -> LexiconDoc<'static> { use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("tools.ozone.queue.defs"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("assignmentView"), LexUserType::Object(LexObject { required: Some(vec![ SmolStr::new_static("id"), SmolStr::new_static("did"), SmolStr::new_static("queue"), SmolStr::new_static("startAt"), ]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("did"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("endAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("id"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("moderator"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static("tools.ozone.team.defs#member"), ..Default::default() }), ); map.insert( SmolStr::new_static("queue"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static("#queueView"), ..Default::default() }), ); map.insert( SmolStr::new_static("startAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("queueStats"), LexUserType::Object(LexObject { required: Some(vec![]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("actionRate"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("actionedCount"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("avgHandlingTimeSec"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("escalatedCount"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("inboundCount"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("lastUpdated"), LexObjectProperty::String(LexString { description: Some(CowStr::new_static( "When these statistics were last computed", )), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("pendingCount"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("queueView"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("id"), SmolStr::new_static("name"), SmolStr::new_static("createdBy"), SmolStr::new_static("createdAt"), SmolStr::new_static("updatedAt"), SmolStr::new_static("enabled"), SmolStr::new_static("stats") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("collection"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Collection name for record subjects (e.g., 'app.bsky.feed.post')", ), ), format: Some(LexStringFormat::Nsid), ..Default::default() }), ); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("createdBy"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "DID of moderator who created this queue", ), ), format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("deletedAt"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "When the queue was deleted, if applicable", ), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("description"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("Optional description of the queue"), ), ..Default::default() }), ); map.insert( SmolStr::new_static("enabled"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map.insert( SmolStr::new_static("id"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("name"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("Display name of the queue"), ), ..Default::default() }), ); map.insert( SmolStr::new_static("recommendedPolicies"), LexObjectProperty::Array(LexArray { description: Some( CowStr::new_static( "Policy keys recommended when actioning reports in this queue", ), ), items: LexArrayItem::String(LexString { ..Default::default() }), ..Default::default() }), ); map.insert( SmolStr::new_static("reportTypes"), LexObjectProperty::Array(LexArray { description: Some( CowStr::new_static( "Report reason types this queue accepts (fully qualified NSIDs)", ), ), items: LexArrayItem::String(LexString { ..Default::default() }), ..Default::default() }), ); map.insert( SmolStr::new_static("stats"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static("#queueStats"), ..Default::default() }), ); map.insert( SmolStr::new_static("subjectTypes"), LexObjectProperty::Array(LexArray { description: Some( CowStr::new_static("Subject types this queue accepts."), ), items: LexArrayItem::String(LexString { ..Default::default() }), ..Default::default() }), ); map.insert( SmolStr::new_static("updatedAt"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map }, ..Default::default() }), ); map }, ..Default::default() }}
fn deserialize_queue_stats_extra_data<'de, S, D>( deserializer: D,) -> Result<Option<BTreeMap<SmolStr, Data<S>>>, D::Error>where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>,{ let data = <Option<BTreeMap<SmolStr, Data<S>>> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty()))}
fn deserialize_queue_view_extra_data<'de, S, D>( deserializer: D,) -> Result<Option<BTreeMap<SmolStr, Data<S>>>, D::Error>where S: BosStr + serde::Deserialize<'de>, D: serde::Deserializer<'de>,{ let data = <Option<BTreeMap<SmolStr, Data<S>>> as serde::Deserialize<'de>>::deserialize(deserializer)?; Ok(data.filter(|extra_data| !extra_data.is_empty()))}
pub mod queue_view_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; type CreatedBy; type Enabled; type Id; type Name; type Stats; type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; type CreatedBy = Unset; type Enabled = Unset; type Id = Unset; type Name = Unset; type Stats = Unset; type UpdatedAt = Unset; } ///State transition - sets the `created_at` field to Set 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 CreatedBy = St::CreatedBy; type Enabled = St::Enabled; type Id = St::Id; type Name = St::Name; type Stats = St::Stats; type UpdatedAt = St::UpdatedAt; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetCreatedBy<St> {} impl<St: State> State for SetCreatedBy<St> { type CreatedAt = St::CreatedAt; type CreatedBy = Set<members::created_by>; type Enabled = St::Enabled; type Id = St::Id; type Name = St::Name; type Stats = St::Stats; type UpdatedAt = St::UpdatedAt; } ///State transition - sets the `enabled` field to Set pub struct SetEnabled<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetEnabled<St> {} impl<St: State> State for SetEnabled<St> { type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Enabled = Set<members::enabled>; type Id = St::Id; type Name = St::Name; type Stats = St::Stats; type UpdatedAt = St::UpdatedAt; } ///State transition - sets the `id` field to Set pub struct SetId<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetId<St> {} impl<St: State> State for SetId<St> { type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Enabled = St::Enabled; type Id = Set<members::id>; type Name = St::Name; type Stats = St::Stats; type UpdatedAt = St::UpdatedAt; } ///State transition - sets the `name` field to Set pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetName<St> {} impl<St: State> State for SetName<St> { type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Enabled = St::Enabled; type Id = St::Id; type Name = Set<members::name>; type Stats = St::Stats; type UpdatedAt = St::UpdatedAt; } ///State transition - sets the `stats` field to Set pub struct SetStats<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetStats<St> {} impl<St: State> State for SetStats<St> { type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Enabled = St::Enabled; type Id = St::Id; type Name = St::Name; type Stats = Set<members::stats>; type UpdatedAt = St::UpdatedAt; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetUpdatedAt<St> {} impl<St: State> State for SetUpdatedAt<St> { type CreatedAt = St::CreatedAt; type CreatedBy = St::CreatedBy; type Enabled = St::Enabled; type Id = St::Id; type Name = St::Name; type Stats = St::Stats; type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `enabled` field pub struct enabled(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `stats` field pub struct stats(()); ///Marker type for the `updated_at` field pub struct updated_at(()); }}
/// Builder for constructing an instance of this type.pub struct QueueViewBuilder<St: queue_view_state::State, S: BosStr = DefaultStr> { _state: PhantomData<fn() -> St>, _fields: ( Option<Nsid<S>>, Option<Datetime>, Option<Did<S>>, Option<Datetime>, Option<S>, Option<bool>, Option<i64>, Option<S>, Option<Vec<S>>, Option<Vec<S>>, Option<queue::QueueStats<S>>, Option<Vec<QueueViewSubjectTypes<S>>>, Option<Datetime>, ), _type: PhantomData<fn() -> S>,}
impl QueueView<DefaultStr> { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> QueueViewBuilder<queue_view_state::Empty, DefaultStr> { QueueViewBuilder::new() }}
impl<S: BosStr> QueueView<S> { /// Create a new builder for this type pub fn builder() -> QueueViewBuilder<queue_view_state::Empty, S> { QueueViewBuilder::builder() }}
impl QueueViewBuilder<queue_view_state::Empty, DefaultStr> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { QueueViewBuilder { _state: PhantomData, _fields: ( None, None, None, None, None, None, None, None, None, None, None, None, None, ), _type: PhantomData, } }}
impl<S: BosStr> QueueViewBuilder<queue_view_state::Empty, S> { /// Create a new builder with all fields unset pub fn builder() -> Self { QueueViewBuilder { _state: PhantomData, _fields: ( None, None, None, None, None, None, None, None, None, None, None, None, None, ), _type: PhantomData, } }}
impl<St: queue_view_state::State, S: BosStr> QueueViewBuilder<St, S> { /// Set the `collection` field (optional) pub fn collection(mut self, value: impl Into<Option<Nsid<S>>>) -> Self { self._fields.0 = value.into(); self } /// Set the `collection` field to an Option value (optional) pub fn maybe_collection(mut self, value: Option<Nsid<S>>) -> Self { self._fields.0 = value; self }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::CreatedAt: queue_view_state::IsUnset,{ /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into<Datetime>, ) -> QueueViewBuilder<queue_view_state::SetCreatedAt<St>, S> { self._fields.1 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::CreatedBy: queue_view_state::IsUnset,{ /// Set the `createdBy` field (required) pub fn created_by( mut self, value: impl Into<Did<S>>, ) -> QueueViewBuilder<queue_view_state::SetCreatedBy<St>, S> { self._fields.2 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St: queue_view_state::State, S: BosStr> QueueViewBuilder<St, S> { /// Set the `deletedAt` field (optional) pub fn deleted_at(mut self, value: impl Into<Option<Datetime>>) -> Self { self._fields.3 = value.into(); self } /// Set the `deletedAt` field to an Option value (optional) pub fn maybe_deleted_at(mut self, value: Option<Datetime>) -> Self { self._fields.3 = value; self }}
impl<St: queue_view_state::State, S: BosStr> QueueViewBuilder<St, S> { /// Set the `description` field (optional) pub fn description(mut self, value: impl Into<Option<S>>) -> Self { self._fields.4 = value.into(); self } /// Set the `description` field to an Option value (optional) pub fn maybe_description(mut self, value: Option<S>) -> Self { self._fields.4 = value; self }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::Enabled: queue_view_state::IsUnset,{ /// Set the `enabled` field (required) pub fn enabled( mut self, value: impl Into<bool>, ) -> QueueViewBuilder<queue_view_state::SetEnabled<St>, S> { self._fields.5 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::Id: queue_view_state::IsUnset,{ /// Set the `id` field (required) pub fn id(mut self, value: impl Into<i64>) -> QueueViewBuilder<queue_view_state::SetId<St>, S> { self._fields.6 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::Name: queue_view_state::IsUnset,{ /// Set the `name` field (required) pub fn name( mut self, value: impl Into<S>, ) -> QueueViewBuilder<queue_view_state::SetName<St>, S> { self._fields.7 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St: queue_view_state::State, S: BosStr> QueueViewBuilder<St, S> { /// Set the `recommendedPolicies` field (optional) pub fn recommended_policies(mut self, value: impl Into<Option<Vec<S>>>) -> Self { self._fields.8 = value.into(); self } /// Set the `recommendedPolicies` field to an Option value (optional) pub fn maybe_recommended_policies(mut self, value: Option<Vec<S>>) -> Self { self._fields.8 = value; self }}
impl<St: queue_view_state::State, S: BosStr> QueueViewBuilder<St, S> { /// Set the `reportTypes` field (optional) pub fn report_types(mut self, value: impl Into<Option<Vec<S>>>) -> Self { self._fields.9 = value.into(); self } /// Set the `reportTypes` field to an Option value (optional) pub fn maybe_report_types(mut self, value: Option<Vec<S>>) -> Self { self._fields.9 = value; self }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::Stats: queue_view_state::IsUnset,{ /// Set the `stats` field (required) pub fn stats( mut self, value: impl Into<queue::QueueStats<S>>, ) -> QueueViewBuilder<queue_view_state::SetStats<St>, S> { self._fields.10 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St: queue_view_state::State, S: BosStr> QueueViewBuilder<St, S> { /// Set the `subjectTypes` field (optional) pub fn subject_types( mut self, value: impl Into<Option<Vec<QueueViewSubjectTypes<S>>>>, ) -> Self { self._fields.11 = value.into(); self } /// Set the `subjectTypes` field to an Option value (optional) pub fn maybe_subject_types(mut self, value: Option<Vec<QueueViewSubjectTypes<S>>>) -> Self { self._fields.11 = value; self }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::UpdatedAt: queue_view_state::IsUnset,{ /// Set the `updatedAt` field (required) pub fn updated_at( mut self, value: impl Into<Datetime>, ) -> QueueViewBuilder<queue_view_state::SetUpdatedAt<St>, S> { self._fields.12 = Option::Some(value.into()); QueueViewBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> QueueViewBuilder<St, S>where St: queue_view_state::State, St::CreatedAt: queue_view_state::IsSet, St::CreatedBy: queue_view_state::IsSet, St::Enabled: queue_view_state::IsSet, St::Id: queue_view_state::IsSet, St::Name: queue_view_state::IsSet, St::Stats: queue_view_state::IsSet, St::UpdatedAt: queue_view_state::IsSet,{ /// Build the final struct. pub fn build(self) -> QueueView<S> { QueueView { collection: self._fields.0, created_at: self._fields.1.unwrap(), created_by: self._fields.2.unwrap(), deleted_at: self._fields.3, description: self._fields.4, enabled: self._fields.5.unwrap(), id: self._fields.6.unwrap(), name: self._fields.7.unwrap(), recommended_policies: self._fields.8, report_types: self._fields.9, stats: self._fields.10.unwrap(), subject_types: self._fields.11, updated_at: self._fields.12.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> QueueView<S> { QueueView { collection: self._fields.0, created_at: self._fields.1.unwrap(), created_by: self._fields.2.unwrap(), deleted_at: self._fields.3, description: self._fields.4, enabled: self._fields.5.unwrap(), id: self._fields.6.unwrap(), name: self._fields.7.unwrap(), recommended_policies: self._fields.8, report_types: self._fields.9, stats: self._fields.10.unwrap(), subject_types: self._fields.11, updated_at: self._fields.12.unwrap(), extra_data: Some(extra_data), } }}