// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: tools.ozone.moderation.scheduleAction // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct FailedScheduling<'a> { #[serde(borrow)] pub error: jacquard_common::CowStr<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub error_code: std::option::Option>, #[serde(borrow)] pub subject: jacquard_common::types::string::Did<'a>, } pub mod failed_scheduling_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[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 Subject; type Error; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Subject = Unset; type Error = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { type Subject = Set; type Error = S::Error; } ///State transition - sets the `error` field to Set pub struct SetError(PhantomData S>); impl sealed::Sealed for SetError {} impl State for SetError { type Subject = S::Subject; type Error = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `error` field pub struct error(()); } } /// Builder for constructing an instance of this type pub struct FailedSchedulingBuilder<'a, S: failed_scheduling_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> FailedScheduling<'a> { /// Create a new builder for this type pub fn new() -> FailedSchedulingBuilder<'a, failed_scheduling_state::Empty> { FailedSchedulingBuilder::new() } } impl<'a> FailedSchedulingBuilder<'a, failed_scheduling_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { FailedSchedulingBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FailedSchedulingBuilder<'a, S> where S: failed_scheduling_state::State, S::Error: failed_scheduling_state::IsUnset, { /// Set the `error` field (required) pub fn error( mut self, value: impl Into>, ) -> FailedSchedulingBuilder<'a, failed_scheduling_state::SetError> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); FailedSchedulingBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: failed_scheduling_state::State> FailedSchedulingBuilder<'a, S> { /// Set the `errorCode` field (optional) pub fn error_code( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `errorCode` field to an Option value (optional) pub fn maybe_error_code( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> FailedSchedulingBuilder<'a, S> where S: failed_scheduling_state::State, S::Subject: failed_scheduling_state::IsUnset, { /// Set the `subject` field (required) pub fn subject( mut self, value: impl Into>, ) -> FailedSchedulingBuilder<'a, failed_scheduling_state::SetSubject> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); FailedSchedulingBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FailedSchedulingBuilder<'a, S> where S: failed_scheduling_state::State, S::Subject: failed_scheduling_state::IsSet, S::Error: failed_scheduling_state::IsSet, { /// Build the final struct pub fn build(self) -> FailedScheduling<'a> { FailedScheduling { error: self.__unsafe_private_named.0.unwrap(), error_code: self.__unsafe_private_named.1, subject: self.__unsafe_private_named.2.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> FailedScheduling<'a> { FailedScheduling { error: self.__unsafe_private_named.0.unwrap(), error_code: self.__unsafe_private_named.1, subject: self.__unsafe_private_named.2.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_tools_ozone_moderation_scheduleAction() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static( "tools.ozone.moderation.scheduleAction", ), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("failedScheduling"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_common::smol_str::SmolStr::new_static("error") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("error"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "errorCode", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcProcedure(::jacquard_lexicon::lexicon::LexXrpcProcedure { description: None, parameters: None, input: Some(::jacquard_lexicon::lexicon::LexXrpcBody { description: None, encoding: ::jacquard_common::CowStr::new_static( "application/json", ), schema: Some( ::jacquard_lexicon::lexicon::LexXrpcBodySchema::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_common::smol_str::SmolStr::new_static("subjects"), ::jacquard_common::smol_str::SmolStr::new_static("createdBy"), ::jacquard_common::smol_str::SmolStr::new_static("scheduling") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("action"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("#takedown") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdBy", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("modTool"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "tools.ozone.moderation.defs#modTool", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "scheduling", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "#schedulingConfig", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "subjects", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "Array of DID subjects to schedule the action for", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), min_length: None, max_length: Some(100usize), }), ); map }, }), ), }), output: None, errors: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "scheduledActionResults", ), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("succeeded"), ::jacquard_common::smol_str::SmolStr::new_static("failed") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("failed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "#failedScheduling", ), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "succeeded", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), min_length: None, max_length: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("schedulingConfig"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Configuration for when the action should be executed", ), ), required: None, nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "executeAfter", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Earliest time to execute the action (for randomized scheduling)", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "executeAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Exact time to execute the action", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "executeUntil", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Latest time to execute the action (for randomized scheduling)", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("takedown"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Schedule a takedown action", ), ), required: None, nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "acknowledgeAccountSubjects", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("comment"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "durationInHours", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "emailContent", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Email content to be sent to the user upon takedown.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "emailSubject", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Subject of the email to be sent to the user upon takedown.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("policies"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "Names/Keywords of the policies that drove the decision.", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), min_length: None, max_length: Some(5usize), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "severityLevel", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.).", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "strikeCount", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "strikeExpiresAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "When the strike should expire. If not provided, the strike never expires.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FailedScheduling<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.scheduleAction" } fn def_name() -> &'static str { "failedScheduling" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_moderation_scheduleAction() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ScheduleAction<'a> { #[serde(borrow)] pub action: crate::tools_ozone::moderation::schedule_action::Takedown<'a>, #[serde(borrow)] pub created_by: jacquard_common::types::string::Did<'a>, /// This will be propagated to the moderation event when it is applied #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub mod_tool: std::option::Option>, #[serde(borrow)] pub scheduling: crate::tools_ozone::moderation::schedule_action::SchedulingConfig< 'a, >, /// Array of DID subjects to schedule the action for #[serde(borrow)] pub subjects: Vec>, } pub mod schedule_action_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[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 Subjects; type Action; type CreatedBy; type Scheduling; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Subjects = Unset; type Action = Unset; type CreatedBy = Unset; type Scheduling = Unset; } ///State transition - sets the `subjects` field to Set pub struct SetSubjects(PhantomData S>); impl sealed::Sealed for SetSubjects {} impl State for SetSubjects { type Subjects = Set; type Action = S::Action; type CreatedBy = S::CreatedBy; type Scheduling = S::Scheduling; } ///State transition - sets the `action` field to Set pub struct SetAction(PhantomData S>); impl sealed::Sealed for SetAction {} impl State for SetAction { type Subjects = S::Subjects; type Action = Set; type CreatedBy = S::CreatedBy; type Scheduling = S::Scheduling; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy(PhantomData S>); impl sealed::Sealed for SetCreatedBy {} impl State for SetCreatedBy { type Subjects = S::Subjects; type Action = S::Action; type CreatedBy = Set; type Scheduling = S::Scheduling; } ///State transition - sets the `scheduling` field to Set pub struct SetScheduling(PhantomData S>); impl sealed::Sealed for SetScheduling {} impl State for SetScheduling { type Subjects = S::Subjects; type Action = S::Action; type CreatedBy = S::CreatedBy; type Scheduling = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `subjects` field pub struct subjects(()); ///Marker type for the `action` field pub struct action(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `scheduling` field pub struct scheduling(()); } } /// Builder for constructing an instance of this type pub struct ScheduleActionBuilder<'a, S: schedule_action_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option< crate::tools_ozone::moderation::schedule_action::Takedown<'a>, >, ::core::option::Option>, ::core::option::Option>, ::core::option::Option< crate::tools_ozone::moderation::schedule_action::SchedulingConfig<'a>, >, ::core::option::Option>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ScheduleAction<'a> { /// Create a new builder for this type pub fn new() -> ScheduleActionBuilder<'a, schedule_action_state::Empty> { ScheduleActionBuilder::new() } } impl<'a> ScheduleActionBuilder<'a, schedule_action_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ScheduleActionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, S::Action: schedule_action_state::IsUnset, { /// Set the `action` field (required) pub fn action( mut self, value: impl Into>, ) -> ScheduleActionBuilder<'a, schedule_action_state::SetAction> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ScheduleActionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, S::CreatedBy: schedule_action_state::IsUnset, { /// Set the `createdBy` field (required) pub fn created_by( mut self, value: impl Into>, ) -> ScheduleActionBuilder<'a, schedule_action_state::SetCreatedBy> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); ScheduleActionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: schedule_action_state::State> ScheduleActionBuilder<'a, S> { /// Set the `modTool` field (optional) pub fn mod_tool( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `modTool` field to an Option value (optional) pub fn maybe_mod_tool( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, S::Scheduling: schedule_action_state::IsUnset, { /// Set the `scheduling` field (required) pub fn scheduling( mut self, value: impl Into< crate::tools_ozone::moderation::schedule_action::SchedulingConfig<'a>, >, ) -> ScheduleActionBuilder<'a, schedule_action_state::SetScheduling> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); ScheduleActionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, S::Subjects: schedule_action_state::IsUnset, { /// Set the `subjects` field (required) pub fn subjects( mut self, value: impl Into>>, ) -> ScheduleActionBuilder<'a, schedule_action_state::SetSubjects> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); ScheduleActionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, S::Subjects: schedule_action_state::IsSet, S::Action: schedule_action_state::IsSet, S::CreatedBy: schedule_action_state::IsSet, S::Scheduling: schedule_action_state::IsSet, { /// Build the final struct pub fn build(self) -> ScheduleAction<'a> { ScheduleAction { action: self.__unsafe_private_named.0.unwrap(), created_by: self.__unsafe_private_named.1.unwrap(), mod_tool: self.__unsafe_private_named.2, scheduling: self.__unsafe_private_named.3.unwrap(), subjects: self.__unsafe_private_named.4.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> ScheduleAction<'a> { ScheduleAction { action: self.__unsafe_private_named.0.unwrap(), created_by: self.__unsafe_private_named.1.unwrap(), mod_tool: self.__unsafe_private_named.2, scheduling: self.__unsafe_private_named.3.unwrap(), subjects: self.__unsafe_private_named.4.unwrap(), extra_data: Some(extra_data), } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ScheduleActionOutput<'a> { #[serde(flatten)] #[serde(borrow)] pub value: jacquard_common::types::value::Data<'a>, } /// Response type for ///tools.ozone.moderation.scheduleAction pub struct ScheduleActionResponse; impl jacquard_common::xrpc::XrpcResp for ScheduleActionResponse { const NSID: &'static str = "tools.ozone.moderation.scheduleAction"; const ENCODING: &'static str = "application/json"; type Output<'de> = ScheduleActionOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for ScheduleAction<'a> { const NSID: &'static str = "tools.ozone.moderation.scheduleAction"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = ScheduleActionResponse; } /// Endpoint type for ///tools.ozone.moderation.scheduleAction pub struct ScheduleActionRequest; impl jacquard_common::xrpc::XrpcEndpoint for ScheduleActionRequest { const PATH: &'static str = "/xrpc/tools.ozone.moderation.scheduleAction"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = ScheduleAction<'de>; type Response = ScheduleActionResponse; } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ScheduledActionResults<'a> { #[serde(borrow)] pub failed: Vec< crate::tools_ozone::moderation::schedule_action::FailedScheduling<'a>, >, #[serde(borrow)] pub succeeded: Vec>, } pub mod scheduled_action_results_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[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 Succeeded; type Failed; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Succeeded = Unset; type Failed = Unset; } ///State transition - sets the `succeeded` field to Set pub struct SetSucceeded(PhantomData S>); impl sealed::Sealed for SetSucceeded {} impl State for SetSucceeded { type Succeeded = Set; type Failed = S::Failed; } ///State transition - sets the `failed` field to Set pub struct SetFailed(PhantomData S>); impl sealed::Sealed for SetFailed {} impl State for SetFailed { type Succeeded = S::Succeeded; type Failed = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `succeeded` field pub struct succeeded(()); ///Marker type for the `failed` field pub struct failed(()); } } /// Builder for constructing an instance of this type pub struct ScheduledActionResultsBuilder<'a, S: scheduled_action_results_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option< Vec>, >, ::core::option::Option>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ScheduledActionResults<'a> { /// Create a new builder for this type pub fn new() -> ScheduledActionResultsBuilder< 'a, scheduled_action_results_state::Empty, > { ScheduledActionResultsBuilder::new() } } impl<'a> ScheduledActionResultsBuilder<'a, scheduled_action_results_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ScheduledActionResultsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduledActionResultsBuilder<'a, S> where S: scheduled_action_results_state::State, S::Failed: scheduled_action_results_state::IsUnset, { /// Set the `failed` field (required) pub fn failed( mut self, value: impl Into< Vec>, >, ) -> ScheduledActionResultsBuilder< 'a, scheduled_action_results_state::SetFailed, > { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ScheduledActionResultsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduledActionResultsBuilder<'a, S> where S: scheduled_action_results_state::State, S::Succeeded: scheduled_action_results_state::IsUnset, { /// Set the `succeeded` field (required) pub fn succeeded( mut self, value: impl Into>>, ) -> ScheduledActionResultsBuilder< 'a, scheduled_action_results_state::SetSucceeded, > { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); ScheduledActionResultsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ScheduledActionResultsBuilder<'a, S> where S: scheduled_action_results_state::State, S::Succeeded: scheduled_action_results_state::IsSet, S::Failed: scheduled_action_results_state::IsSet, { /// Build the final struct pub fn build(self) -> ScheduledActionResults<'a> { ScheduledActionResults { failed: self.__unsafe_private_named.0.unwrap(), succeeded: self.__unsafe_private_named.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> ScheduledActionResults<'a> { ScheduledActionResults { failed: self.__unsafe_private_named.0.unwrap(), succeeded: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ScheduledActionResults<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.scheduleAction" } fn def_name() -> &'static str { "scheduledActionResults" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_moderation_scheduleAction() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Configuration for when the action should be executed #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct SchedulingConfig<'a> { /// Earliest time to execute the action (for randomized scheduling) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub execute_after: std::option::Option, /// Exact time to execute the action #[serde(skip_serializing_if = "std::option::Option::is_none")] pub execute_at: std::option::Option, /// Latest time to execute the action (for randomized scheduling) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub execute_until: std::option::Option, } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SchedulingConfig<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.scheduleAction" } fn def_name() -> &'static str { "schedulingConfig" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_moderation_scheduleAction() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Schedule a takedown action #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Takedown<'a> { /// If true, all other reports on content authored by this account will be resolved (acknowledged). #[serde(skip_serializing_if = "std::option::Option::is_none")] pub acknowledge_account_subjects: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub comment: std::option::Option>, /// Indicates how long the takedown should be in effect before automatically expiring. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub duration_in_hours: std::option::Option, /// Email content to be sent to the user upon takedown. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub email_content: std::option::Option>, /// Subject of the email to be sent to the user upon takedown. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub email_subject: std::option::Option>, /// Names/Keywords of the policies that drove the decision. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub policies: std::option::Option>>, /// Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.). #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub severity_level: std::option::Option>, /// Number of strikes to assign to the user when takedown is applied. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub strike_count: std::option::Option, /// When the strike should expire. If not provided, the strike never expires. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub strike_expires_at: std::option::Option, } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Takedown<'a> { fn nsid() -> &'static str { "tools.ozone.moderation.scheduleAction" } fn def_name() -> &'static str { "takedown" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_moderation_scheduleAction() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.policies { #[allow(unused_comparisons)] if value.len() > 5usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "policies", ), max: 5usize, actual: value.len(), }); } } Ok(()) } }