atproto blogging
at main 545 lines 21 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: tools.ozone.verification.revokeVerifications 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 jacquard_derive::IntoStatic 17)] 18#[serde(rename_all = "camelCase")] 19pub struct RevokeVerifications<'a> { 20 /// Reason for revoking the verification. This is optional and can be omitted if not needed. 21 #[serde(skip_serializing_if = "std::option::Option::is_none")] 22 #[serde(borrow)] 23 pub revoke_reason: std::option::Option<jacquard_common::CowStr<'a>>, 24 /// Array of verification record uris to revoke 25 #[serde(borrow)] 26 pub uris: Vec<jacquard_common::types::string::AtUri<'a>>, 27} 28 29pub mod revoke_verifications_state { 30 31 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 32 #[allow(unused)] 33 use ::core::marker::PhantomData; 34 mod sealed { 35 pub trait Sealed {} 36 } 37 /// State trait tracking which required fields have been set 38 pub trait State: sealed::Sealed { 39 type Uris; 40 } 41 /// Empty state - all required fields are unset 42 pub struct Empty(()); 43 impl sealed::Sealed for Empty {} 44 impl State for Empty { 45 type Uris = Unset; 46 } 47 ///State transition - sets the `uris` field to Set 48 pub struct SetUris<S: State = Empty>(PhantomData<fn() -> S>); 49 impl<S: State> sealed::Sealed for SetUris<S> {} 50 impl<S: State> State for SetUris<S> { 51 type Uris = Set<members::uris>; 52 } 53 /// Marker types for field names 54 #[allow(non_camel_case_types)] 55 pub mod members { 56 ///Marker type for the `uris` field 57 pub struct uris(()); 58 } 59} 60 61/// Builder for constructing an instance of this type 62pub struct RevokeVerificationsBuilder<'a, S: revoke_verifications_state::State> { 63 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 64 __unsafe_private_named: ( 65 ::core::option::Option<jacquard_common::CowStr<'a>>, 66 ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, 67 ), 68 _phantom: ::core::marker::PhantomData<&'a ()>, 69} 70 71impl<'a> RevokeVerifications<'a> { 72 /// Create a new builder for this type 73 pub fn new() -> RevokeVerificationsBuilder<'a, revoke_verifications_state::Empty> { 74 RevokeVerificationsBuilder::new() 75 } 76} 77 78impl<'a> RevokeVerificationsBuilder<'a, revoke_verifications_state::Empty> { 79 /// Create a new builder with all fields unset 80 pub fn new() -> Self { 81 RevokeVerificationsBuilder { 82 _phantom_state: ::core::marker::PhantomData, 83 __unsafe_private_named: (None, None), 84 _phantom: ::core::marker::PhantomData, 85 } 86 } 87} 88 89impl<'a, S: revoke_verifications_state::State> RevokeVerificationsBuilder<'a, S> { 90 /// Set the `revokeReason` field (optional) 91 pub fn revoke_reason( 92 mut self, 93 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 94 ) -> Self { 95 self.__unsafe_private_named.0 = value.into(); 96 self 97 } 98 /// Set the `revokeReason` field to an Option value (optional) 99 pub fn maybe_revoke_reason( 100 mut self, 101 value: Option<jacquard_common::CowStr<'a>>, 102 ) -> Self { 103 self.__unsafe_private_named.0 = value; 104 self 105 } 106} 107 108impl<'a, S> RevokeVerificationsBuilder<'a, S> 109where 110 S: revoke_verifications_state::State, 111 S::Uris: revoke_verifications_state::IsUnset, 112{ 113 /// Set the `uris` field (required) 114 pub fn uris( 115 mut self, 116 value: impl Into<Vec<jacquard_common::types::string::AtUri<'a>>>, 117 ) -> RevokeVerificationsBuilder<'a, revoke_verifications_state::SetUris<S>> { 118 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 119 RevokeVerificationsBuilder { 120 _phantom_state: ::core::marker::PhantomData, 121 __unsafe_private_named: self.__unsafe_private_named, 122 _phantom: ::core::marker::PhantomData, 123 } 124 } 125} 126 127impl<'a, S> RevokeVerificationsBuilder<'a, S> 128where 129 S: revoke_verifications_state::State, 130 S::Uris: revoke_verifications_state::IsSet, 131{ 132 /// Build the final struct 133 pub fn build(self) -> RevokeVerifications<'a> { 134 RevokeVerifications { 135 revoke_reason: self.__unsafe_private_named.0, 136 uris: self.__unsafe_private_named.1.unwrap(), 137 extra_data: Default::default(), 138 } 139 } 140 /// Build the final struct with custom extra_data 141 pub fn build_with_data( 142 self, 143 extra_data: std::collections::BTreeMap< 144 jacquard_common::smol_str::SmolStr, 145 jacquard_common::types::value::Data<'a>, 146 >, 147 ) -> RevokeVerifications<'a> { 148 RevokeVerifications { 149 revoke_reason: self.__unsafe_private_named.0, 150 uris: self.__unsafe_private_named.1.unwrap(), 151 extra_data: Some(extra_data), 152 } 153 } 154} 155 156#[jacquard_derive::lexicon] 157#[derive( 158 serde::Serialize, 159 serde::Deserialize, 160 Debug, 161 Clone, 162 PartialEq, 163 Eq, 164 jacquard_derive::IntoStatic 165)] 166#[serde(rename_all = "camelCase")] 167pub struct RevokeVerificationsOutput<'a> { 168 /// List of verification uris that couldn't be revoked, including failure reasons 169 #[serde(borrow)] 170 pub failed_revocations: Vec< 171 crate::tools_ozone::verification::revoke_verifications::RevokeError<'a>, 172 >, 173 /// List of verification uris successfully revoked 174 #[serde(borrow)] 175 pub revoked_verifications: Vec<jacquard_common::types::string::AtUri<'a>>, 176} 177 178/// Response type for 179///tools.ozone.verification.revokeVerifications 180pub struct RevokeVerificationsResponse; 181impl jacquard_common::xrpc::XrpcResp for RevokeVerificationsResponse { 182 const NSID: &'static str = "tools.ozone.verification.revokeVerifications"; 183 const ENCODING: &'static str = "application/json"; 184 type Output<'de> = RevokeVerificationsOutput<'de>; 185 type Err<'de> = jacquard_common::xrpc::GenericError<'de>; 186} 187 188impl<'a> jacquard_common::xrpc::XrpcRequest for RevokeVerifications<'a> { 189 const NSID: &'static str = "tools.ozone.verification.revokeVerifications"; 190 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 191 "application/json", 192 ); 193 type Response = RevokeVerificationsResponse; 194} 195 196/// Endpoint type for 197///tools.ozone.verification.revokeVerifications 198pub struct RevokeVerificationsRequest; 199impl jacquard_common::xrpc::XrpcEndpoint for RevokeVerificationsRequest { 200 const PATH: &'static str = "/xrpc/tools.ozone.verification.revokeVerifications"; 201 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 202 "application/json", 203 ); 204 type Request<'de> = RevokeVerifications<'de>; 205 type Response = RevokeVerificationsResponse; 206} 207 208/// Error object for failed revocations 209#[jacquard_derive::lexicon] 210#[derive( 211 serde::Serialize, 212 serde::Deserialize, 213 Debug, 214 Clone, 215 PartialEq, 216 Eq, 217 jacquard_derive::IntoStatic 218)] 219#[serde(rename_all = "camelCase")] 220pub struct RevokeError<'a> { 221 /// Description of the error that occurred during revocation. 222 #[serde(borrow)] 223 pub error: jacquard_common::CowStr<'a>, 224 /// The AT-URI of the verification record that failed to revoke. 225 #[serde(borrow)] 226 pub uri: jacquard_common::types::string::AtUri<'a>, 227} 228 229pub mod revoke_error_state { 230 231 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 232 #[allow(unused)] 233 use ::core::marker::PhantomData; 234 mod sealed { 235 pub trait Sealed {} 236 } 237 /// State trait tracking which required fields have been set 238 pub trait State: sealed::Sealed { 239 type Error; 240 type Uri; 241 } 242 /// Empty state - all required fields are unset 243 pub struct Empty(()); 244 impl sealed::Sealed for Empty {} 245 impl State for Empty { 246 type Error = Unset; 247 type Uri = Unset; 248 } 249 ///State transition - sets the `error` field to Set 250 pub struct SetError<S: State = Empty>(PhantomData<fn() -> S>); 251 impl<S: State> sealed::Sealed for SetError<S> {} 252 impl<S: State> State for SetError<S> { 253 type Error = Set<members::error>; 254 type Uri = S::Uri; 255 } 256 ///State transition - sets the `uri` field to Set 257 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 258 impl<S: State> sealed::Sealed for SetUri<S> {} 259 impl<S: State> State for SetUri<S> { 260 type Error = S::Error; 261 type Uri = Set<members::uri>; 262 } 263 /// Marker types for field names 264 #[allow(non_camel_case_types)] 265 pub mod members { 266 ///Marker type for the `error` field 267 pub struct error(()); 268 ///Marker type for the `uri` field 269 pub struct uri(()); 270 } 271} 272 273/// Builder for constructing an instance of this type 274pub struct RevokeErrorBuilder<'a, S: revoke_error_state::State> { 275 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 276 __unsafe_private_named: ( 277 ::core::option::Option<jacquard_common::CowStr<'a>>, 278 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 279 ), 280 _phantom: ::core::marker::PhantomData<&'a ()>, 281} 282 283impl<'a> RevokeError<'a> { 284 /// Create a new builder for this type 285 pub fn new() -> RevokeErrorBuilder<'a, revoke_error_state::Empty> { 286 RevokeErrorBuilder::new() 287 } 288} 289 290impl<'a> RevokeErrorBuilder<'a, revoke_error_state::Empty> { 291 /// Create a new builder with all fields unset 292 pub fn new() -> Self { 293 RevokeErrorBuilder { 294 _phantom_state: ::core::marker::PhantomData, 295 __unsafe_private_named: (None, None), 296 _phantom: ::core::marker::PhantomData, 297 } 298 } 299} 300 301impl<'a, S> RevokeErrorBuilder<'a, S> 302where 303 S: revoke_error_state::State, 304 S::Error: revoke_error_state::IsUnset, 305{ 306 /// Set the `error` field (required) 307 pub fn error( 308 mut self, 309 value: impl Into<jacquard_common::CowStr<'a>>, 310 ) -> RevokeErrorBuilder<'a, revoke_error_state::SetError<S>> { 311 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 312 RevokeErrorBuilder { 313 _phantom_state: ::core::marker::PhantomData, 314 __unsafe_private_named: self.__unsafe_private_named, 315 _phantom: ::core::marker::PhantomData, 316 } 317 } 318} 319 320impl<'a, S> RevokeErrorBuilder<'a, S> 321where 322 S: revoke_error_state::State, 323 S::Uri: revoke_error_state::IsUnset, 324{ 325 /// Set the `uri` field (required) 326 pub fn uri( 327 mut self, 328 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 329 ) -> RevokeErrorBuilder<'a, revoke_error_state::SetUri<S>> { 330 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 331 RevokeErrorBuilder { 332 _phantom_state: ::core::marker::PhantomData, 333 __unsafe_private_named: self.__unsafe_private_named, 334 _phantom: ::core::marker::PhantomData, 335 } 336 } 337} 338 339impl<'a, S> RevokeErrorBuilder<'a, S> 340where 341 S: revoke_error_state::State, 342 S::Error: revoke_error_state::IsSet, 343 S::Uri: revoke_error_state::IsSet, 344{ 345 /// Build the final struct 346 pub fn build(self) -> RevokeError<'a> { 347 RevokeError { 348 error: self.__unsafe_private_named.0.unwrap(), 349 uri: self.__unsafe_private_named.1.unwrap(), 350 extra_data: Default::default(), 351 } 352 } 353 /// Build the final struct with custom extra_data 354 pub fn build_with_data( 355 self, 356 extra_data: std::collections::BTreeMap< 357 jacquard_common::smol_str::SmolStr, 358 jacquard_common::types::value::Data<'a>, 359 >, 360 ) -> RevokeError<'a> { 361 RevokeError { 362 error: self.__unsafe_private_named.0.unwrap(), 363 uri: self.__unsafe_private_named.1.unwrap(), 364 extra_data: Some(extra_data), 365 } 366 } 367} 368 369fn lexicon_doc_tools_ozone_verification_revokeVerifications() -> ::jacquard_lexicon::lexicon::LexiconDoc< 370 'static, 371> { 372 ::jacquard_lexicon::lexicon::LexiconDoc { 373 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 374 id: ::jacquard_common::CowStr::new_static( 375 "tools.ozone.verification.revokeVerifications", 376 ), 377 revision: None, 378 description: None, 379 defs: { 380 let mut map = ::alloc::collections::BTreeMap::new(); 381 map.insert( 382 ::jacquard_common::smol_str::SmolStr::new_static("main"), 383 ::jacquard_lexicon::lexicon::LexUserType::XrpcProcedure(::jacquard_lexicon::lexicon::LexXrpcProcedure { 384 description: None, 385 parameters: None, 386 input: Some(::jacquard_lexicon::lexicon::LexXrpcBody { 387 description: None, 388 encoding: ::jacquard_common::CowStr::new_static( 389 "application/json", 390 ), 391 schema: Some( 392 ::jacquard_lexicon::lexicon::LexXrpcBodySchema::Object(::jacquard_lexicon::lexicon::LexObject { 393 description: None, 394 required: Some( 395 vec![ 396 ::jacquard_common::smol_str::SmolStr::new_static("uris") 397 ], 398 ), 399 nullable: None, 400 properties: { 401 #[allow(unused_mut)] 402 let mut map = ::alloc::collections::BTreeMap::new(); 403 map.insert( 404 ::jacquard_common::smol_str::SmolStr::new_static( 405 "revokeReason", 406 ), 407 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 408 description: Some( 409 ::jacquard_common::CowStr::new_static( 410 "Reason for revoking the verification. This is optional and can be omitted if not needed.", 411 ), 412 ), 413 format: None, 414 default: None, 415 min_length: None, 416 max_length: Some(1000usize), 417 min_graphemes: None, 418 max_graphemes: None, 419 r#enum: None, 420 r#const: None, 421 known_values: None, 422 }), 423 ); 424 map.insert( 425 ::jacquard_common::smol_str::SmolStr::new_static("uris"), 426 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 427 description: Some( 428 ::jacquard_common::CowStr::new_static( 429 "Array of verification record uris to revoke", 430 ), 431 ), 432 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { 433 description: Some( 434 ::jacquard_common::CowStr::new_static( 435 "The AT-URI of the verification record to revoke.", 436 ), 437 ), 438 format: Some( 439 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 440 ), 441 default: None, 442 min_length: None, 443 max_length: None, 444 min_graphemes: None, 445 max_graphemes: None, 446 r#enum: None, 447 r#const: None, 448 known_values: None, 449 }), 450 min_length: None, 451 max_length: Some(100usize), 452 }), 453 ); 454 map 455 }, 456 }), 457 ), 458 }), 459 output: None, 460 errors: None, 461 }), 462 ); 463 map.insert( 464 ::jacquard_common::smol_str::SmolStr::new_static("revokeError"), 465 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 466 description: Some( 467 ::jacquard_common::CowStr::new_static( 468 "Error object for failed revocations", 469 ), 470 ), 471 required: Some( 472 vec![ 473 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 474 ::jacquard_common::smol_str::SmolStr::new_static("error") 475 ], 476 ), 477 nullable: None, 478 properties: { 479 #[allow(unused_mut)] 480 let mut map = ::alloc::collections::BTreeMap::new(); 481 map.insert( 482 ::jacquard_common::smol_str::SmolStr::new_static("error"), 483 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 484 description: Some( 485 ::jacquard_common::CowStr::new_static( 486 "Description of the error that occurred during revocation.", 487 ), 488 ), 489 format: None, 490 default: None, 491 min_length: None, 492 max_length: None, 493 min_graphemes: None, 494 max_graphemes: None, 495 r#enum: None, 496 r#const: None, 497 known_values: None, 498 }), 499 ); 500 map.insert( 501 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 502 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 503 description: Some( 504 ::jacquard_common::CowStr::new_static( 505 "The AT-URI of the verification record that failed to revoke.", 506 ), 507 ), 508 format: Some( 509 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 510 ), 511 default: None, 512 min_length: None, 513 max_length: None, 514 min_graphemes: None, 515 max_graphemes: None, 516 r#enum: None, 517 r#const: None, 518 known_values: None, 519 }), 520 ); 521 map 522 }, 523 }), 524 ); 525 map 526 }, 527 } 528} 529 530impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RevokeError<'a> { 531 fn nsid() -> &'static str { 532 "tools.ozone.verification.revokeVerifications" 533 } 534 fn def_name() -> &'static str { 535 "revokeError" 536 } 537 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 538 lexicon_doc_tools_ozone_verification_revokeVerifications() 539 } 540 fn validate( 541 &self, 542 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 543 Ok(()) 544 } 545}