// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: tools.ozone.verification.grantVerifications // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// Error object for failed verifications. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct GrantError<'a> { /// Error message describing the reason for failure. #[serde(borrow)] pub error: jacquard_common::CowStr<'a>, /// The did of the subject being verified #[serde(borrow)] pub subject: jacquard_common::types::string::Did<'a>, } pub mod grant_error_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 Error; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Error = Unset; type Subject = Unset; } ///State transition - sets the `error` field to Set pub struct SetError(PhantomData S>); impl sealed::Sealed for SetError {} impl State for SetError { type Error = 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 Error = S::Error; type Subject = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `error` field pub struct error(()); ///Marker type for the `subject` field pub struct subject(()); } } /// Builder for constructing an instance of this type pub struct GrantErrorBuilder<'a, S: grant_error_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> GrantError<'a> { /// Create a new builder for this type pub fn new() -> GrantErrorBuilder<'a, grant_error_state::Empty> { GrantErrorBuilder::new() } } impl<'a> GrantErrorBuilder<'a, grant_error_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { GrantErrorBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GrantErrorBuilder<'a, S> where S: grant_error_state::State, S::Error: grant_error_state::IsUnset, { /// Set the `error` field (required) pub fn error( mut self, value: impl Into>, ) -> GrantErrorBuilder<'a, grant_error_state::SetError> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); GrantErrorBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GrantErrorBuilder<'a, S> where S: grant_error_state::State, S::Subject: grant_error_state::IsUnset, { /// Set the `subject` field (required) pub fn subject( mut self, value: impl Into>, ) -> GrantErrorBuilder<'a, grant_error_state::SetSubject> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); GrantErrorBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GrantErrorBuilder<'a, S> where S: grant_error_state::State, S::Error: grant_error_state::IsSet, S::Subject: grant_error_state::IsSet, { /// Build the final struct pub fn build(self) -> GrantError<'a> { GrantError { error: self.__unsafe_private_named.0.unwrap(), subject: 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>, >, ) -> GrantError<'a> { GrantError { error: self.__unsafe_private_named.0.unwrap(), subject: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_tools_ozone_verification_grantVerifications() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static( "tools.ozone.verification.grantVerifications", ), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("grantError"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Error object for failed verifications.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("error"), ::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("error"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Error message describing the reason for failure.", ), ), 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: Some( ::jacquard_common::CowStr::new_static( "The did of the subject being verified", ), ), 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("verifications") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "verifications", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "Array of verification requests to process", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "#verificationInput", ), }), min_length: None, max_length: Some(100usize), }), ); map }, }), ), }), output: None, errors: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("verificationInput"), ::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("handle"), ::jacquard_common::smol_str::SmolStr::new_static("displayName") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Timestamp for verification record. Defaults to current time when not specified.", ), ), 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( "displayName", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Display name of the subject the verification applies to at the moment of verifying.", ), ), 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("handle"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Handle of the subject the verification applies to at the moment of verifying.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Handle, ), 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: Some( ::jacquard_common::CowStr::new_static( "The did of the subject being verified", ), ), 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 }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GrantError<'a> { fn nsid() -> &'static str { "tools.ozone.verification.grantVerifications" } fn def_name() -> &'static str { "grantError" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_verification_grantVerifications() } 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 GrantVerifications<'a> { /// Array of verification requests to process #[serde(borrow)] pub verifications: Vec< crate::tools_ozone::verification::grant_verifications::VerificationInput<'a>, >, } pub mod grant_verifications_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 Verifications; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Verifications = Unset; } ///State transition - sets the `verifications` field to Set pub struct SetVerifications(PhantomData S>); impl sealed::Sealed for SetVerifications {} impl State for SetVerifications { type Verifications = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `verifications` field pub struct verifications(()); } } /// Builder for constructing an instance of this type pub struct GrantVerificationsBuilder<'a, S: grant_verifications_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option< Vec< crate::tools_ozone::verification::grant_verifications::VerificationInput< 'a, >, >, >, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> GrantVerifications<'a> { /// Create a new builder for this type pub fn new() -> GrantVerificationsBuilder<'a, grant_verifications_state::Empty> { GrantVerificationsBuilder::new() } } impl<'a> GrantVerificationsBuilder<'a, grant_verifications_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { GrantVerificationsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GrantVerificationsBuilder<'a, S> where S: grant_verifications_state::State, S::Verifications: grant_verifications_state::IsUnset, { /// Set the `verifications` field (required) pub fn verifications( mut self, value: impl Into< Vec< crate::tools_ozone::verification::grant_verifications::VerificationInput< 'a, >, >, >, ) -> GrantVerificationsBuilder<'a, grant_verifications_state::SetVerifications> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); GrantVerificationsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> GrantVerificationsBuilder<'a, S> where S: grant_verifications_state::State, S::Verifications: grant_verifications_state::IsSet, { /// Build the final struct pub fn build(self) -> GrantVerifications<'a> { GrantVerifications { verifications: self.__unsafe_private_named.0.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>, >, ) -> GrantVerifications<'a> { GrantVerifications { verifications: self.__unsafe_private_named.0.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 GrantVerificationsOutput<'a> { #[serde(borrow)] pub failed_verifications: Vec< crate::tools_ozone::verification::grant_verifications::GrantError<'a>, >, #[serde(borrow)] pub verifications: Vec>, } /// Response type for ///tools.ozone.verification.grantVerifications pub struct GrantVerificationsResponse; impl jacquard_common::xrpc::XrpcResp for GrantVerificationsResponse { const NSID: &'static str = "tools.ozone.verification.grantVerifications"; const ENCODING: &'static str = "application/json"; type Output<'de> = GrantVerificationsOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for GrantVerifications<'a> { const NSID: &'static str = "tools.ozone.verification.grantVerifications"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = GrantVerificationsResponse; } /// Endpoint type for ///tools.ozone.verification.grantVerifications pub struct GrantVerificationsRequest; impl jacquard_common::xrpc::XrpcEndpoint for GrantVerificationsRequest { const PATH: &'static str = "/xrpc/tools.ozone.verification.grantVerifications"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = GrantVerifications<'de>; type Response = GrantVerificationsResponse; } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct VerificationInput<'a> { /// Timestamp for verification record. Defaults to current time when not specified. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub created_at: std::option::Option, /// Display name of the subject the verification applies to at the moment of verifying. #[serde(borrow)] pub display_name: jacquard_common::CowStr<'a>, /// Handle of the subject the verification applies to at the moment of verifying. #[serde(borrow)] pub handle: jacquard_common::types::string::Handle<'a>, /// The did of the subject being verified #[serde(borrow)] pub subject: jacquard_common::types::string::Did<'a>, } pub mod verification_input_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 Handle; type DisplayName; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Subject = Unset; type Handle = Unset; type DisplayName = 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 Handle = S::Handle; type DisplayName = S::DisplayName; } ///State transition - sets the `handle` field to Set pub struct SetHandle(PhantomData S>); impl sealed::Sealed for SetHandle {} impl State for SetHandle { type Subject = S::Subject; type Handle = Set; type DisplayName = S::DisplayName; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName(PhantomData S>); impl sealed::Sealed for SetDisplayName {} impl State for SetDisplayName { type Subject = S::Subject; type Handle = S::Handle; type DisplayName = 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 `handle` field pub struct handle(()); ///Marker type for the `display_name` field pub struct display_name(()); } } /// Builder for constructing an instance of this type pub struct VerificationInputBuilder<'a, S: verification_input_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> VerificationInput<'a> { /// Create a new builder for this type pub fn new() -> VerificationInputBuilder<'a, verification_input_state::Empty> { VerificationInputBuilder::new() } } impl<'a> VerificationInputBuilder<'a, verification_input_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { VerificationInputBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: verification_input_state::State> VerificationInputBuilder<'a, S> { /// Set the `createdAt` field (optional) pub fn created_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `createdAt` field to an Option value (optional) pub fn maybe_created_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> VerificationInputBuilder<'a, S> where S: verification_input_state::State, S::DisplayName: verification_input_state::IsUnset, { /// Set the `displayName` field (required) pub fn display_name( mut self, value: impl Into>, ) -> VerificationInputBuilder<'a, verification_input_state::SetDisplayName> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); VerificationInputBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> VerificationInputBuilder<'a, S> where S: verification_input_state::State, S::Handle: verification_input_state::IsUnset, { /// Set the `handle` field (required) pub fn handle( mut self, value: impl Into>, ) -> VerificationInputBuilder<'a, verification_input_state::SetHandle> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); VerificationInputBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> VerificationInputBuilder<'a, S> where S: verification_input_state::State, S::Subject: verification_input_state::IsUnset, { /// Set the `subject` field (required) pub fn subject( mut self, value: impl Into>, ) -> VerificationInputBuilder<'a, verification_input_state::SetSubject> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); VerificationInputBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> VerificationInputBuilder<'a, S> where S: verification_input_state::State, S::Subject: verification_input_state::IsSet, S::Handle: verification_input_state::IsSet, S::DisplayName: verification_input_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationInput<'a> { VerificationInput { created_at: self.__unsafe_private_named.0, display_name: self.__unsafe_private_named.1.unwrap(), handle: 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>, >, ) -> VerificationInput<'a> { VerificationInput { created_at: self.__unsafe_private_named.0, display_name: self.__unsafe_private_named.1.unwrap(), handle: self.__unsafe_private_named.2.unwrap(), subject: self.__unsafe_private_named.3.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for VerificationInput<'a> { fn nsid() -> &'static str { "tools.ozone.verification.grantVerifications" } fn def_name() -> &'static str { "verificationInput" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_verification_grantVerifications() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }