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::{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::{Did, Nsid, 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::tools_ozone::team::Member;
use crate::tools_ozone::queue;
#[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,
#[serde(skip_serializing_if = "Option::is_none")]
pub moderator: Option<Member<S>>,
pub queue: queue::QueueView<S>,
pub start_at: Datetime,
#[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 QueueStats<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub action_rate: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub actioned_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub avg_handling_time_sec: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub escalated_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub inbound_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_updated: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pending_count: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct QueueView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub collection: Option<Nsid<S>>,
pub created_at: Datetime,
pub created_by: Did<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<S>,
pub enabled: bool,
pub id: i64,
pub name: S,
pub report_types: Vec<S>,
pub stats: queue::QueueStats<S>,
pub subject_types: Vec<S>,
pub updated_at: Datetime,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
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> {
{
let value = &self.report_types;
#[allow(unused_comparisons)]
if value.len() < 1usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("report_types"),
min: 1usize,
actual: value.len(),
});
}
}
{
let value = &self.subject_types;
#[allow(unused_comparisons)]
if value.len() < 1usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("subject_types"),
min: 1usize,
actual: value.len(),
});
}
}
Ok(())
}
}
pub mod assignment_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 Did;
type Id;
type Queue;
type StartAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
type Id = Unset;
type Queue = Unset;
type StartAt = Unset;
}
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;
}
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;
}
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;
}
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>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
pub struct id(());
pub struct queue(());
pub struct start_at(());
}
}
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> {
pub fn new() -> AssignmentViewBuilder<assignment_view_state::Empty, DefaultStr> {
AssignmentViewBuilder::new()
}
}
impl<S: BosStr> AssignmentView<S> {
pub fn builder() -> AssignmentViewBuilder<assignment_view_state::Empty, S> {
AssignmentViewBuilder::builder()
}
}
impl AssignmentViewBuilder<assignment_view_state::Empty, DefaultStr> {
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> {
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,
{
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> {
pub fn end_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.1 = value.into();
self
}
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,
{
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> {
pub fn moderator(mut self, value: impl Into<Option<Member<S>>>) -> Self {
self._fields.3 = value.into();
self
}
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,
{
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,
{
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,
{
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(),
}
}
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> {
#[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("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("subjectTypes"),
SmolStr::new_static("reportTypes"),
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("reportTypes"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Report reason types this queue accepts (fully qualified NSIDs)",
),
),
items: LexArrayItem::String(LexString {
..Default::default()
}),
min_length: Some(1usize),
..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()
}),
min_length: Some(1usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod queue_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 CreatedAt;
type CreatedBy;
type Enabled;
type Id;
type Name;
type ReportTypes;
type Stats;
type SubjectTypes;
type UpdatedAt;
}
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 ReportTypes = Unset;
type Stats = Unset;
type SubjectTypes = Unset;
type UpdatedAt = Unset;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type CreatedAt = Set<members::created_at>;
type CreatedBy = St::CreatedBy;
type Enabled = St::Enabled;
type Id = St::Id;
type Name = St::Name;
type ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
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 ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
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 ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
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 ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
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 ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
pub struct SetReportTypes<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReportTypes<St> {}
impl<St: State> State for SetReportTypes<St> {
type CreatedAt = St::CreatedAt;
type CreatedBy = St::CreatedBy;
type Enabled = St::Enabled;
type Id = St::Id;
type Name = St::Name;
type ReportTypes = Set<members::report_types>;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
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 ReportTypes = St::ReportTypes;
type Stats = Set<members::stats>;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = St::UpdatedAt;
}
pub struct SetSubjectTypes<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubjectTypes<St> {}
impl<St: State> State for SetSubjectTypes<St> {
type CreatedAt = St::CreatedAt;
type CreatedBy = St::CreatedBy;
type Enabled = St::Enabled;
type Id = St::Id;
type Name = St::Name;
type ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = Set<members::subject_types>;
type UpdatedAt = St::UpdatedAt;
}
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 ReportTypes = St::ReportTypes;
type Stats = St::Stats;
type SubjectTypes = St::SubjectTypes;
type UpdatedAt = Set<members::updated_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct created_by(());
pub struct enabled(());
pub struct id(());
pub struct name(());
pub struct report_types(());
pub struct stats(());
pub struct subject_types(());
pub struct updated_at(());
}
}
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<queue::QueueStats<S>>,
Option<Vec<S>>,
Option<Datetime>,
),
_type: PhantomData<fn() -> S>,
}
impl QueueView<DefaultStr> {
pub fn new() -> QueueViewBuilder<queue_view_state::Empty, DefaultStr> {
QueueViewBuilder::new()
}
}
impl<S: BosStr> QueueView<S> {
pub fn builder() -> QueueViewBuilder<queue_view_state::Empty, S> {
QueueViewBuilder::builder()
}
}
impl QueueViewBuilder<queue_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
QueueViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> QueueViewBuilder<queue_view_state::Empty, S> {
pub fn builder() -> Self {
QueueViewBuilder {
_state: PhantomData,
_fields: (
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> {
pub fn collection(mut self, value: impl Into<Option<Nsid<S>>>) -> Self {
self._fields.0 = value.into();
self
}
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,
{
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,
{
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> {
pub fn deleted_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
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> {
pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.4 = value.into();
self
}
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,
{
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,
{
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,
{
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, S: BosStr> QueueViewBuilder<St, S>
where
St: queue_view_state::State,
St::ReportTypes: queue_view_state::IsUnset,
{
pub fn report_types(
mut self,
value: impl Into<Vec<S>>,
) -> QueueViewBuilder<queue_view_state::SetReportTypes<St>, S> {
self._fields.8 = 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::Stats: queue_view_state::IsUnset,
{
pub fn stats(
mut self,
value: impl Into<queue::QueueStats<S>>,
) -> QueueViewBuilder<queue_view_state::SetStats<St>, S> {
self._fields.9 = 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::SubjectTypes: queue_view_state::IsUnset,
{
pub fn subject_types(
mut self,
value: impl Into<Vec<S>>,
) -> QueueViewBuilder<queue_view_state::SetSubjectTypes<St>, S> {
self._fields.10 = 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::UpdatedAt: queue_view_state::IsUnset,
{
pub fn updated_at(
mut self,
value: impl Into<Datetime>,
) -> QueueViewBuilder<queue_view_state::SetUpdatedAt<St>, S> {
self._fields.11 = 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::ReportTypes: queue_view_state::IsSet,
St::Stats: queue_view_state::IsSet,
St::SubjectTypes: queue_view_state::IsSet,
St::UpdatedAt: queue_view_state::IsSet,
{
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(),
report_types: self._fields.8.unwrap(),
stats: self._fields.9.unwrap(),
subject_types: self._fields.10.unwrap(),
updated_at: self._fields.11.unwrap(),
extra_data: Default::default(),
}
}
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(),
report_types: self._fields.8.unwrap(),
stats: self._fields.9.unwrap(),
subject_types: self._fields.10.unwrap(),
updated_at: self._fields.11.unwrap(),
extra_data: Some(extra_data),
}
}
}