// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.moderation.createReport // // 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 CreateReport<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub mod_tool: std::option::Option< crate::com_atproto::moderation::create_report::ModTool<'a>, >, /// Additional context about the content and violation. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub reason: std::option::Option>, /// Indicates the broad category of violation the report is for. #[serde(borrow)] pub reason_type: crate::com_atproto::moderation::ReasonType<'a>, #[serde(borrow)] pub subject: CreateReportSubject<'a>, } pub mod create_report_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 ReasonType; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type ReasonType = Unset; type Subject = Unset; } ///State transition - sets the `reason_type` field to Set pub struct SetReasonType(PhantomData S>); impl sealed::Sealed for SetReasonType {} impl State for SetReasonType { type ReasonType = Set; type Subject = S::Subject; } ///State transition - sets the `subject` field to Set pub struct SetSubject(PhantomData S>); impl sealed::Sealed for SetSubject {} impl State for SetSubject { type ReasonType = S::ReasonType; type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `reason_type` field pub struct reason_type(()); ///Marker type for the `subject` field pub struct subject(()); } } /// Builder for constructing an instance of this type pub struct CreateReportBuilder<'a, S: create_report_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option< crate::com_atproto::moderation::create_report::ModTool<'a>, >, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> CreateReport<'a> { /// Create a new builder for this type pub fn new() -> CreateReportBuilder<'a, create_report_state::Empty> { CreateReportBuilder::new() } } impl<'a> CreateReportBuilder<'a, create_report_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CreateReportBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: create_report_state::State> CreateReportBuilder<'a, S> { /// Set the `modTool` field (optional) pub fn mod_tool( mut self, value: impl Into< Option>, >, ) -> Self { self.__unsafe_private_named.0 = 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.0 = value; self } } impl<'a, S: create_report_state::State> CreateReportBuilder<'a, S> { /// Set the `reason` field (optional) pub fn reason( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `reason` field to an Option value (optional) pub fn maybe_reason(mut self, value: Option>) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> CreateReportBuilder<'a, S> where S: create_report_state::State, S::ReasonType: create_report_state::IsUnset, { /// Set the `reasonType` field (required) pub fn reason_type( mut self, value: impl Into>, ) -> CreateReportBuilder<'a, create_report_state::SetReasonType> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); CreateReportBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CreateReportBuilder<'a, S> where S: create_report_state::State, S::Subject: create_report_state::IsUnset, { /// Set the `subject` field (required) pub fn subject( mut self, value: impl Into>, ) -> CreateReportBuilder<'a, create_report_state::SetSubject> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); CreateReportBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CreateReportBuilder<'a, S> where S: create_report_state::State, S::ReasonType: create_report_state::IsSet, S::Subject: create_report_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateReport<'a> { CreateReport { mod_tool: self.__unsafe_private_named.0, reason: self.__unsafe_private_named.1, reason_type: self.__unsafe_private_named.2.unwrap(), subject: self.__unsafe_private_named.3.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>, >, ) -> CreateReport<'a> { CreateReport { mod_tool: self.__unsafe_private_named.0, reason: self.__unsafe_private_named.1, reason_type: self.__unsafe_private_named.2.unwrap(), subject: self.__unsafe_private_named.3.unwrap(), extra_data: Some(extra_data), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum CreateReportSubject<'a> { #[serde(rename = "com.atproto.admin.defs#repoRef")] RepoRef(Box>), #[serde(rename = "com.atproto.repo.strongRef")] StrongRef(Box>), } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CreateReportOutput<'a> { pub created_at: jacquard_common::types::string::Datetime, pub id: i64, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub reason: std::option::Option>, #[serde(borrow)] pub reason_type: crate::com_atproto::moderation::ReasonType<'a>, #[serde(borrow)] pub reported_by: jacquard_common::types::string::Did<'a>, #[serde(borrow)] pub subject: CreateReportOutputSubject<'a>, } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum CreateReportOutputSubject<'a> { #[serde(rename = "com.atproto.admin.defs#repoRef")] RepoRef(Box>), #[serde(rename = "com.atproto.repo.strongRef")] StrongRef(Box>), } /// Response type for ///com.atproto.moderation.createReport pub struct CreateReportResponse; impl jacquard_common::xrpc::XrpcResp for CreateReportResponse { const NSID: &'static str = "com.atproto.moderation.createReport"; const ENCODING: &'static str = "application/json"; type Output<'de> = CreateReportOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for CreateReport<'a> { const NSID: &'static str = "com.atproto.moderation.createReport"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = CreateReportResponse; } /// Endpoint type for ///com.atproto.moderation.createReport pub struct CreateReportRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateReportRequest { const PATH: &'static str = "/xrpc/com.atproto.moderation.createReport"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = CreateReport<'de>; type Response = CreateReportResponse; } /// Moderation tool information for tracing the source of the action #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct ModTool<'a> { /// Additional arbitrary metadata about the source #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub meta: std::option::Option>, /// Name/identifier of the source (e.g., 'bsky-app/android', 'bsky-web/chrome') #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, } fn lexicon_doc_com_atproto_moderation_createReport() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("com.atproto.moderation.createReport"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); 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("reasonType"), ::jacquard_common::smol_str::SmolStr::new_static("subject") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); 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("#modTool"), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("reason"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Additional context about the content and violation.", ), ), format: None, default: None, min_length: None, max_length: Some(20000usize), min_graphemes: None, max_graphemes: Some(2000usize), r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "reasonType", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.atproto.moderation.defs#reasonType", ), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("com.atproto.admin.defs#repoRef"), ::jacquard_common::CowStr::new_static("com.atproto.repo.strongRef") ], closed: None, }), ); map }, }), ), }), output: None, errors: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("modTool"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Moderation tool information for tracing the source of the action", ), ), required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("name")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("meta"), ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Name/identifier of the source (e.g., 'bsky-app/android', 'bsky-web/chrome')", ), ), 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 }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ModTool<'a> { fn nsid() -> &'static str { "com.atproto.moderation.createReport" } fn def_name() -> &'static str { "modTool" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_com_atproto_moderation_createReport() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }