atproto blogging
at main 2158 lines 79 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.weaver.embed.records 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 Records<'a> { 20 #[serde(borrow)] 21 pub records: Vec<crate::sh_weaver::embed::records::RecordEmbed<'a>>, 22} 23 24pub mod records_state { 25 26 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 27 #[allow(unused)] 28 use ::core::marker::PhantomData; 29 mod sealed { 30 pub trait Sealed {} 31 } 32 /// State trait tracking which required fields have been set 33 pub trait State: sealed::Sealed { 34 type Records; 35 } 36 /// Empty state - all required fields are unset 37 pub struct Empty(()); 38 impl sealed::Sealed for Empty {} 39 impl State for Empty { 40 type Records = Unset; 41 } 42 ///State transition - sets the `records` field to Set 43 pub struct SetRecords<S: State = Empty>(PhantomData<fn() -> S>); 44 impl<S: State> sealed::Sealed for SetRecords<S> {} 45 impl<S: State> State for SetRecords<S> { 46 type Records = Set<members::records>; 47 } 48 /// Marker types for field names 49 #[allow(non_camel_case_types)] 50 pub mod members { 51 ///Marker type for the `records` field 52 pub struct records(()); 53 } 54} 55 56/// Builder for constructing an instance of this type 57pub struct RecordsBuilder<'a, S: records_state::State> { 58 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 59 __unsafe_private_named: ( 60 ::core::option::Option<Vec<crate::sh_weaver::embed::records::RecordEmbed<'a>>>, 61 ), 62 _phantom: ::core::marker::PhantomData<&'a ()>, 63} 64 65impl<'a> Records<'a> { 66 /// Create a new builder for this type 67 pub fn new() -> RecordsBuilder<'a, records_state::Empty> { 68 RecordsBuilder::new() 69 } 70} 71 72impl<'a> RecordsBuilder<'a, records_state::Empty> { 73 /// Create a new builder with all fields unset 74 pub fn new() -> Self { 75 RecordsBuilder { 76 _phantom_state: ::core::marker::PhantomData, 77 __unsafe_private_named: (None,), 78 _phantom: ::core::marker::PhantomData, 79 } 80 } 81} 82 83impl<'a, S> RecordsBuilder<'a, S> 84where 85 S: records_state::State, 86 S::Records: records_state::IsUnset, 87{ 88 /// Set the `records` field (required) 89 pub fn records( 90 mut self, 91 value: impl Into<Vec<crate::sh_weaver::embed::records::RecordEmbed<'a>>>, 92 ) -> RecordsBuilder<'a, records_state::SetRecords<S>> { 93 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 94 RecordsBuilder { 95 _phantom_state: ::core::marker::PhantomData, 96 __unsafe_private_named: self.__unsafe_private_named, 97 _phantom: ::core::marker::PhantomData, 98 } 99 } 100} 101 102impl<'a, S> RecordsBuilder<'a, S> 103where 104 S: records_state::State, 105 S::Records: records_state::IsSet, 106{ 107 /// Build the final struct 108 pub fn build(self) -> Records<'a> { 109 Records { 110 records: self.__unsafe_private_named.0.unwrap(), 111 extra_data: Default::default(), 112 } 113 } 114 /// Build the final struct with custom extra_data 115 pub fn build_with_data( 116 self, 117 extra_data: std::collections::BTreeMap< 118 jacquard_common::smol_str::SmolStr, 119 jacquard_common::types::value::Data<'a>, 120 >, 121 ) -> Records<'a> { 122 Records { 123 records: self.__unsafe_private_named.0.unwrap(), 124 extra_data: Some(extra_data), 125 } 126 } 127} 128 129fn lexicon_doc_sh_weaver_embed_records() -> ::jacquard_lexicon::lexicon::LexiconDoc< 130 'static, 131> { 132 ::jacquard_lexicon::lexicon::LexiconDoc { 133 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 134 id: ::jacquard_common::CowStr::new_static("sh.weaver.embed.records"), 135 revision: None, 136 description: None, 137 defs: { 138 let mut map = ::alloc::collections::BTreeMap::new(); 139 map.insert( 140 ::jacquard_common::smol_str::SmolStr::new_static("main"), 141 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 142 description: None, 143 required: Some( 144 vec![::jacquard_common::smol_str::SmolStr::new_static("records")], 145 ), 146 nullable: None, 147 properties: { 148 #[allow(unused_mut)] 149 let mut map = ::alloc::collections::BTreeMap::new(); 150 map.insert( 151 ::jacquard_common::smol_str::SmolStr::new_static("records"), 152 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 153 description: None, 154 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 155 description: None, 156 r#ref: ::jacquard_common::CowStr::new_static("#recordEmbed"), 157 }), 158 min_length: None, 159 max_length: Some(48usize), 160 }), 161 ); 162 map 163 }, 164 }), 165 ); 166 map.insert( 167 ::jacquard_common::smol_str::SmolStr::new_static("recordEmbed"), 168 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 169 description: None, 170 required: Some( 171 vec![::jacquard_common::smol_str::SmolStr::new_static("record")], 172 ), 173 nullable: None, 174 properties: { 175 #[allow(unused_mut)] 176 let mut map = ::alloc::collections::BTreeMap::new(); 177 map.insert( 178 ::jacquard_common::smol_str::SmolStr::new_static("name"), 179 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 180 description: None, 181 format: None, 182 default: None, 183 min_length: None, 184 max_length: Some(128usize), 185 min_graphemes: None, 186 max_graphemes: None, 187 r#enum: None, 188 r#const: None, 189 known_values: None, 190 }), 191 ); 192 map.insert( 193 ::jacquard_common::smol_str::SmolStr::new_static("record"), 194 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 195 description: None, 196 r#ref: ::jacquard_common::CowStr::new_static( 197 "com.atproto.repo.strongRef", 198 ), 199 }), 200 ); 201 map 202 }, 203 }), 204 ); 205 map.insert( 206 ::jacquard_common::smol_str::SmolStr::new_static("recordEmbedView"), 207 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 208 description: None, 209 required: Some( 210 vec![ 211 ::jacquard_common::smol_str::SmolStr::new_static("recordView") 212 ], 213 ), 214 nullable: None, 215 properties: { 216 #[allow(unused_mut)] 217 let mut map = ::alloc::collections::BTreeMap::new(); 218 map.insert( 219 ::jacquard_common::smol_str::SmolStr::new_static("name"), 220 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 221 description: None, 222 format: None, 223 default: None, 224 min_length: None, 225 max_length: Some(128usize), 226 min_graphemes: None, 227 max_graphemes: None, 228 r#enum: None, 229 r#const: None, 230 known_values: None, 231 }), 232 ); 233 map.insert( 234 ::jacquard_common::smol_str::SmolStr::new_static( 235 "recordView", 236 ), 237 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 238 description: None, 239 refs: vec![ 240 ::jacquard_common::CowStr::new_static("sh.weaver.embed.records#view"), 241 ::jacquard_common::CowStr::new_static("sh.weaver.embed.images#view"), 242 ::jacquard_common::CowStr::new_static("sh.weaver.embed.recordWithMedia#view"), 243 ::jacquard_common::CowStr::new_static("sh.weaver.embed.video#view") 244 ], 245 closed: None, 246 }), 247 ); 248 map 249 }, 250 }), 251 ); 252 map.insert( 253 ::jacquard_common::smol_str::SmolStr::new_static("view"), 254 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 255 description: None, 256 required: Some( 257 vec![::jacquard_common::smol_str::SmolStr::new_static("record")], 258 ), 259 nullable: None, 260 properties: { 261 #[allow(unused_mut)] 262 let mut map = ::alloc::collections::BTreeMap::new(); 263 map.insert( 264 ::jacquard_common::smol_str::SmolStr::new_static("record"), 265 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 266 description: None, 267 refs: vec![ 268 ::jacquard_common::CowStr::new_static("#viewRecord"), 269 ::jacquard_common::CowStr::new_static("#viewNotFound"), 270 ::jacquard_common::CowStr::new_static("#viewBlocked"), 271 ::jacquard_common::CowStr::new_static("#viewDetached"), 272 ::jacquard_common::CowStr::new_static("app.bsky.feed.defs#generatorView"), 273 ::jacquard_common::CowStr::new_static("app.bsky.graph.defs#listView"), 274 ::jacquard_common::CowStr::new_static("app.bsky.labeler.defs#labelerView"), 275 ::jacquard_common::CowStr::new_static("app.bsky.graph.defs#starterPackViewBasic") 276 ], 277 closed: None, 278 }), 279 ); 280 map 281 }, 282 }), 283 ); 284 map.insert( 285 ::jacquard_common::smol_str::SmolStr::new_static("viewBlocked"), 286 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 287 description: None, 288 required: Some( 289 vec![ 290 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 291 ::jacquard_common::smol_str::SmolStr::new_static("blocked"), 292 ::jacquard_common::smol_str::SmolStr::new_static("author") 293 ], 294 ), 295 nullable: None, 296 properties: { 297 #[allow(unused_mut)] 298 let mut map = ::alloc::collections::BTreeMap::new(); 299 map.insert( 300 ::jacquard_common::smol_str::SmolStr::new_static("author"), 301 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 302 description: None, 303 r#ref: ::jacquard_common::CowStr::new_static( 304 "app.bsky.feed.defs#blockedAuthor", 305 ), 306 }), 307 ); 308 map.insert( 309 ::jacquard_common::smol_str::SmolStr::new_static("blocked"), 310 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 311 description: None, 312 default: None, 313 r#const: None, 314 }), 315 ); 316 map.insert( 317 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 318 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 319 description: None, 320 format: Some( 321 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 322 ), 323 default: None, 324 min_length: None, 325 max_length: None, 326 min_graphemes: None, 327 max_graphemes: None, 328 r#enum: None, 329 r#const: None, 330 known_values: None, 331 }), 332 ); 333 map 334 }, 335 }), 336 ); 337 map.insert( 338 ::jacquard_common::smol_str::SmolStr::new_static("viewDetached"), 339 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 340 description: None, 341 required: Some( 342 vec![ 343 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 344 ::jacquard_common::smol_str::SmolStr::new_static("detached") 345 ], 346 ), 347 nullable: None, 348 properties: { 349 #[allow(unused_mut)] 350 let mut map = ::alloc::collections::BTreeMap::new(); 351 map.insert( 352 ::jacquard_common::smol_str::SmolStr::new_static("detached"), 353 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 354 description: None, 355 default: None, 356 r#const: None, 357 }), 358 ); 359 map.insert( 360 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 361 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 362 description: None, 363 format: Some( 364 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 365 ), 366 default: None, 367 min_length: None, 368 max_length: None, 369 min_graphemes: None, 370 max_graphemes: None, 371 r#enum: None, 372 r#const: None, 373 known_values: None, 374 }), 375 ); 376 map 377 }, 378 }), 379 ); 380 map.insert( 381 ::jacquard_common::smol_str::SmolStr::new_static("viewNotFound"), 382 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 383 description: None, 384 required: Some( 385 vec![ 386 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 387 ::jacquard_common::smol_str::SmolStr::new_static("notFound") 388 ], 389 ), 390 nullable: None, 391 properties: { 392 #[allow(unused_mut)] 393 let mut map = ::alloc::collections::BTreeMap::new(); 394 map.insert( 395 ::jacquard_common::smol_str::SmolStr::new_static("notFound"), 396 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 397 description: None, 398 default: None, 399 r#const: None, 400 }), 401 ); 402 map.insert( 403 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 404 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 405 description: None, 406 format: Some( 407 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 408 ), 409 default: None, 410 min_length: None, 411 max_length: None, 412 min_graphemes: None, 413 max_graphemes: None, 414 r#enum: None, 415 r#const: None, 416 known_values: None, 417 }), 418 ); 419 map 420 }, 421 }), 422 ); 423 map.insert( 424 ::jacquard_common::smol_str::SmolStr::new_static("viewRecord"), 425 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 426 description: None, 427 required: Some( 428 vec![ 429 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 430 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 431 ::jacquard_common::smol_str::SmolStr::new_static("author"), 432 ::jacquard_common::smol_str::SmolStr::new_static("value"), 433 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") 434 ], 435 ), 436 nullable: None, 437 properties: { 438 #[allow(unused_mut)] 439 let mut map = ::alloc::collections::BTreeMap::new(); 440 map.insert( 441 ::jacquard_common::smol_str::SmolStr::new_static("author"), 442 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 443 description: None, 444 r#ref: ::jacquard_common::CowStr::new_static( 445 "sh.weaver.actor.defs#profileDataViewBasic", 446 ), 447 }), 448 ); 449 map.insert( 450 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 451 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 452 description: None, 453 format: Some( 454 ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 455 ), 456 default: None, 457 min_length: None, 458 max_length: None, 459 min_graphemes: None, 460 max_graphemes: None, 461 r#enum: None, 462 r#const: None, 463 known_values: None, 464 }), 465 ); 466 map.insert( 467 ::jacquard_common::smol_str::SmolStr::new_static("embeds"), 468 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 469 description: None, 470 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 471 description: None, 472 r#ref: ::jacquard_common::CowStr::new_static( 473 "#recordEmbedView", 474 ), 475 }), 476 min_length: None, 477 max_length: None, 478 }), 479 ); 480 map.insert( 481 ::jacquard_common::smol_str::SmolStr::new_static( 482 "indexedAt", 483 ), 484 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 485 description: None, 486 format: Some( 487 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 488 ), 489 default: None, 490 min_length: None, 491 max_length: None, 492 min_graphemes: None, 493 max_graphemes: None, 494 r#enum: None, 495 r#const: None, 496 known_values: None, 497 }), 498 ); 499 map.insert( 500 ::jacquard_common::smol_str::SmolStr::new_static("labels"), 501 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 502 description: None, 503 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 504 description: None, 505 r#ref: ::jacquard_common::CowStr::new_static( 506 "com.atproto.label.defs#label", 507 ), 508 }), 509 min_length: None, 510 max_length: None, 511 }), 512 ); 513 map.insert( 514 ::jacquard_common::smol_str::SmolStr::new_static( 515 "likeCount", 516 ), 517 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 518 description: None, 519 default: None, 520 minimum: None, 521 maximum: None, 522 r#enum: None, 523 r#const: None, 524 }), 525 ); 526 map.insert( 527 ::jacquard_common::smol_str::SmolStr::new_static( 528 "quoteCount", 529 ), 530 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 531 description: None, 532 default: None, 533 minimum: None, 534 maximum: None, 535 r#enum: None, 536 r#const: None, 537 }), 538 ); 539 map.insert( 540 ::jacquard_common::smol_str::SmolStr::new_static( 541 "replyCount", 542 ), 543 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 544 description: None, 545 default: None, 546 minimum: None, 547 maximum: None, 548 r#enum: None, 549 r#const: None, 550 }), 551 ); 552 map.insert( 553 ::jacquard_common::smol_str::SmolStr::new_static( 554 "repostCount", 555 ), 556 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 557 description: None, 558 default: None, 559 minimum: None, 560 maximum: None, 561 r#enum: None, 562 r#const: None, 563 }), 564 ); 565 map.insert( 566 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 567 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 568 description: None, 569 format: Some( 570 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 571 ), 572 default: None, 573 min_length: None, 574 max_length: None, 575 min_graphemes: None, 576 max_graphemes: None, 577 r#enum: None, 578 r#const: None, 579 known_values: None, 580 }), 581 ); 582 map.insert( 583 ::jacquard_common::smol_str::SmolStr::new_static("value"), 584 ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { 585 description: None, 586 }), 587 ); 588 map 589 }, 590 }), 591 ); 592 map 593 }, 594 } 595} 596 597impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Records<'a> { 598 fn nsid() -> &'static str { 599 "sh.weaver.embed.records" 600 } 601 fn def_name() -> &'static str { 602 "main" 603 } 604 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 605 lexicon_doc_sh_weaver_embed_records() 606 } 607 fn validate( 608 &self, 609 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 610 { 611 let value = &self.records; 612 #[allow(unused_comparisons)] 613 if value.len() > 48usize { 614 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 615 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 616 "records", 617 ), 618 max: 48usize, 619 actual: value.len(), 620 }); 621 } 622 } 623 Ok(()) 624 } 625} 626 627#[jacquard_derive::lexicon] 628#[derive( 629 serde::Serialize, 630 serde::Deserialize, 631 Debug, 632 Clone, 633 PartialEq, 634 Eq, 635 jacquard_derive::IntoStatic 636)] 637#[serde(rename_all = "camelCase")] 638pub struct RecordEmbed<'a> { 639 #[serde(skip_serializing_if = "std::option::Option::is_none")] 640 #[serde(borrow)] 641 pub name: std::option::Option<jacquard_common::CowStr<'a>>, 642 #[serde(borrow)] 643 pub record: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 644} 645 646pub mod record_embed_state { 647 648 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 649 #[allow(unused)] 650 use ::core::marker::PhantomData; 651 mod sealed { 652 pub trait Sealed {} 653 } 654 /// State trait tracking which required fields have been set 655 pub trait State: sealed::Sealed { 656 type Record; 657 } 658 /// Empty state - all required fields are unset 659 pub struct Empty(()); 660 impl sealed::Sealed for Empty {} 661 impl State for Empty { 662 type Record = Unset; 663 } 664 ///State transition - sets the `record` field to Set 665 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); 666 impl<S: State> sealed::Sealed for SetRecord<S> {} 667 impl<S: State> State for SetRecord<S> { 668 type Record = Set<members::record>; 669 } 670 /// Marker types for field names 671 #[allow(non_camel_case_types)] 672 pub mod members { 673 ///Marker type for the `record` field 674 pub struct record(()); 675 } 676} 677 678/// Builder for constructing an instance of this type 679pub struct RecordEmbedBuilder<'a, S: record_embed_state::State> { 680 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 681 __unsafe_private_named: ( 682 ::core::option::Option<jacquard_common::CowStr<'a>>, 683 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 684 ), 685 _phantom: ::core::marker::PhantomData<&'a ()>, 686} 687 688impl<'a> RecordEmbed<'a> { 689 /// Create a new builder for this type 690 pub fn new() -> RecordEmbedBuilder<'a, record_embed_state::Empty> { 691 RecordEmbedBuilder::new() 692 } 693} 694 695impl<'a> RecordEmbedBuilder<'a, record_embed_state::Empty> { 696 /// Create a new builder with all fields unset 697 pub fn new() -> Self { 698 RecordEmbedBuilder { 699 _phantom_state: ::core::marker::PhantomData, 700 __unsafe_private_named: (None, None), 701 _phantom: ::core::marker::PhantomData, 702 } 703 } 704} 705 706impl<'a, S: record_embed_state::State> RecordEmbedBuilder<'a, S> { 707 /// Set the `name` field (optional) 708 pub fn name( 709 mut self, 710 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 711 ) -> Self { 712 self.__unsafe_private_named.0 = value.into(); 713 self 714 } 715 /// Set the `name` field to an Option value (optional) 716 pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 717 self.__unsafe_private_named.0 = value; 718 self 719 } 720} 721 722impl<'a, S> RecordEmbedBuilder<'a, S> 723where 724 S: record_embed_state::State, 725 S::Record: record_embed_state::IsUnset, 726{ 727 /// Set the `record` field (required) 728 pub fn record( 729 mut self, 730 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 731 ) -> RecordEmbedBuilder<'a, record_embed_state::SetRecord<S>> { 732 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 733 RecordEmbedBuilder { 734 _phantom_state: ::core::marker::PhantomData, 735 __unsafe_private_named: self.__unsafe_private_named, 736 _phantom: ::core::marker::PhantomData, 737 } 738 } 739} 740 741impl<'a, S> RecordEmbedBuilder<'a, S> 742where 743 S: record_embed_state::State, 744 S::Record: record_embed_state::IsSet, 745{ 746 /// Build the final struct 747 pub fn build(self) -> RecordEmbed<'a> { 748 RecordEmbed { 749 name: self.__unsafe_private_named.0, 750 record: self.__unsafe_private_named.1.unwrap(), 751 extra_data: Default::default(), 752 } 753 } 754 /// Build the final struct with custom extra_data 755 pub fn build_with_data( 756 self, 757 extra_data: std::collections::BTreeMap< 758 jacquard_common::smol_str::SmolStr, 759 jacquard_common::types::value::Data<'a>, 760 >, 761 ) -> RecordEmbed<'a> { 762 RecordEmbed { 763 name: self.__unsafe_private_named.0, 764 record: self.__unsafe_private_named.1.unwrap(), 765 extra_data: Some(extra_data), 766 } 767 } 768} 769 770impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordEmbed<'a> { 771 fn nsid() -> &'static str { 772 "sh.weaver.embed.records" 773 } 774 fn def_name() -> &'static str { 775 "recordEmbed" 776 } 777 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 778 lexicon_doc_sh_weaver_embed_records() 779 } 780 fn validate( 781 &self, 782 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 783 if let Some(ref value) = self.name { 784 #[allow(unused_comparisons)] 785 if <str>::len(value.as_ref()) > 128usize { 786 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 787 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 788 "name", 789 ), 790 max: 128usize, 791 actual: <str>::len(value.as_ref()), 792 }); 793 } 794 } 795 Ok(()) 796 } 797} 798 799#[jacquard_derive::lexicon] 800#[derive( 801 serde::Serialize, 802 serde::Deserialize, 803 Debug, 804 Clone, 805 PartialEq, 806 Eq, 807 jacquard_derive::IntoStatic 808)] 809#[serde(rename_all = "camelCase")] 810pub struct RecordEmbedView<'a> { 811 #[serde(skip_serializing_if = "std::option::Option::is_none")] 812 #[serde(borrow)] 813 pub name: std::option::Option<jacquard_common::CowStr<'a>>, 814 #[serde(borrow)] 815 pub record_view: RecordEmbedViewRecordView<'a>, 816} 817 818pub mod record_embed_view_state { 819 820 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 821 #[allow(unused)] 822 use ::core::marker::PhantomData; 823 mod sealed { 824 pub trait Sealed {} 825 } 826 /// State trait tracking which required fields have been set 827 pub trait State: sealed::Sealed { 828 type RecordView; 829 } 830 /// Empty state - all required fields are unset 831 pub struct Empty(()); 832 impl sealed::Sealed for Empty {} 833 impl State for Empty { 834 type RecordView = Unset; 835 } 836 ///State transition - sets the `record_view` field to Set 837 pub struct SetRecordView<S: State = Empty>(PhantomData<fn() -> S>); 838 impl<S: State> sealed::Sealed for SetRecordView<S> {} 839 impl<S: State> State for SetRecordView<S> { 840 type RecordView = Set<members::record_view>; 841 } 842 /// Marker types for field names 843 #[allow(non_camel_case_types)] 844 pub mod members { 845 ///Marker type for the `record_view` field 846 pub struct record_view(()); 847 } 848} 849 850/// Builder for constructing an instance of this type 851pub struct RecordEmbedViewBuilder<'a, S: record_embed_view_state::State> { 852 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 853 __unsafe_private_named: ( 854 ::core::option::Option<jacquard_common::CowStr<'a>>, 855 ::core::option::Option<RecordEmbedViewRecordView<'a>>, 856 ), 857 _phantom: ::core::marker::PhantomData<&'a ()>, 858} 859 860impl<'a> RecordEmbedView<'a> { 861 /// Create a new builder for this type 862 pub fn new() -> RecordEmbedViewBuilder<'a, record_embed_view_state::Empty> { 863 RecordEmbedViewBuilder::new() 864 } 865} 866 867impl<'a> RecordEmbedViewBuilder<'a, record_embed_view_state::Empty> { 868 /// Create a new builder with all fields unset 869 pub fn new() -> Self { 870 RecordEmbedViewBuilder { 871 _phantom_state: ::core::marker::PhantomData, 872 __unsafe_private_named: (None, None), 873 _phantom: ::core::marker::PhantomData, 874 } 875 } 876} 877 878impl<'a, S: record_embed_view_state::State> RecordEmbedViewBuilder<'a, S> { 879 /// Set the `name` field (optional) 880 pub fn name( 881 mut self, 882 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 883 ) -> Self { 884 self.__unsafe_private_named.0 = value.into(); 885 self 886 } 887 /// Set the `name` field to an Option value (optional) 888 pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 889 self.__unsafe_private_named.0 = value; 890 self 891 } 892} 893 894impl<'a, S> RecordEmbedViewBuilder<'a, S> 895where 896 S: record_embed_view_state::State, 897 S::RecordView: record_embed_view_state::IsUnset, 898{ 899 /// Set the `recordView` field (required) 900 pub fn record_view( 901 mut self, 902 value: impl Into<RecordEmbedViewRecordView<'a>>, 903 ) -> RecordEmbedViewBuilder<'a, record_embed_view_state::SetRecordView<S>> { 904 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 905 RecordEmbedViewBuilder { 906 _phantom_state: ::core::marker::PhantomData, 907 __unsafe_private_named: self.__unsafe_private_named, 908 _phantom: ::core::marker::PhantomData, 909 } 910 } 911} 912 913impl<'a, S> RecordEmbedViewBuilder<'a, S> 914where 915 S: record_embed_view_state::State, 916 S::RecordView: record_embed_view_state::IsSet, 917{ 918 /// Build the final struct 919 pub fn build(self) -> RecordEmbedView<'a> { 920 RecordEmbedView { 921 name: self.__unsafe_private_named.0, 922 record_view: self.__unsafe_private_named.1.unwrap(), 923 extra_data: Default::default(), 924 } 925 } 926 /// Build the final struct with custom extra_data 927 pub fn build_with_data( 928 self, 929 extra_data: std::collections::BTreeMap< 930 jacquard_common::smol_str::SmolStr, 931 jacquard_common::types::value::Data<'a>, 932 >, 933 ) -> RecordEmbedView<'a> { 934 RecordEmbedView { 935 name: self.__unsafe_private_named.0, 936 record_view: self.__unsafe_private_named.1.unwrap(), 937 extra_data: Some(extra_data), 938 } 939 } 940} 941 942#[jacquard_derive::open_union] 943#[derive( 944 serde::Serialize, 945 serde::Deserialize, 946 Debug, 947 Clone, 948 PartialEq, 949 Eq, 950 jacquard_derive::IntoStatic 951)] 952#[serde(tag = "$type")] 953#[serde(bound(deserialize = "'de: 'a"))] 954pub enum RecordEmbedViewRecordView<'a> { 955 #[serde(rename = "sh.weaver.embed.records#view")] 956 View(Box<crate::sh_weaver::embed::records::View<'a>>), 957 #[serde(rename = "sh.weaver.embed.images#view")] 958 ImagesView(Box<crate::sh_weaver::embed::images::View<'a>>), 959 #[serde(rename = "sh.weaver.embed.recordWithMedia#view")] 960 RecordWithMediaView(Box<crate::sh_weaver::embed::record_with_media::View<'a>>), 961 #[serde(rename = "sh.weaver.embed.video#view")] 962 VideoView(Box<crate::sh_weaver::embed::video::View<'a>>), 963} 964 965impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RecordEmbedView<'a> { 966 fn nsid() -> &'static str { 967 "sh.weaver.embed.records" 968 } 969 fn def_name() -> &'static str { 970 "recordEmbedView" 971 } 972 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 973 lexicon_doc_sh_weaver_embed_records() 974 } 975 fn validate( 976 &self, 977 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 978 if let Some(ref value) = self.name { 979 #[allow(unused_comparisons)] 980 if <str>::len(value.as_ref()) > 128usize { 981 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 982 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 983 "name", 984 ), 985 max: 128usize, 986 actual: <str>::len(value.as_ref()), 987 }); 988 } 989 } 990 Ok(()) 991 } 992} 993 994#[jacquard_derive::lexicon] 995#[derive( 996 serde::Serialize, 997 serde::Deserialize, 998 Debug, 999 Clone, 1000 PartialEq, 1001 Eq, 1002 jacquard_derive::IntoStatic 1003)] 1004#[serde(rename_all = "camelCase")] 1005pub struct View<'a> { 1006 #[serde(borrow)] 1007 pub record: ViewUnionRecord<'a>, 1008} 1009 1010pub mod view_state { 1011 1012 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1013 #[allow(unused)] 1014 use ::core::marker::PhantomData; 1015 mod sealed { 1016 pub trait Sealed {} 1017 } 1018 /// State trait tracking which required fields have been set 1019 pub trait State: sealed::Sealed { 1020 type Record; 1021 } 1022 /// Empty state - all required fields are unset 1023 pub struct Empty(()); 1024 impl sealed::Sealed for Empty {} 1025 impl State for Empty { 1026 type Record = Unset; 1027 } 1028 ///State transition - sets the `record` field to Set 1029 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); 1030 impl<S: State> sealed::Sealed for SetRecord<S> {} 1031 impl<S: State> State for SetRecord<S> { 1032 type Record = Set<members::record>; 1033 } 1034 /// Marker types for field names 1035 #[allow(non_camel_case_types)] 1036 pub mod members { 1037 ///Marker type for the `record` field 1038 pub struct record(()); 1039 } 1040} 1041 1042/// Builder for constructing an instance of this type 1043pub struct ViewBuilder<'a, S: view_state::State> { 1044 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1045 __unsafe_private_named: (::core::option::Option<ViewUnionRecord<'a>>,), 1046 _phantom: ::core::marker::PhantomData<&'a ()>, 1047} 1048 1049impl<'a> View<'a> { 1050 /// Create a new builder for this type 1051 pub fn new() -> ViewBuilder<'a, view_state::Empty> { 1052 ViewBuilder::new() 1053 } 1054} 1055 1056impl<'a> ViewBuilder<'a, view_state::Empty> { 1057 /// Create a new builder with all fields unset 1058 pub fn new() -> Self { 1059 ViewBuilder { 1060 _phantom_state: ::core::marker::PhantomData, 1061 __unsafe_private_named: (None,), 1062 _phantom: ::core::marker::PhantomData, 1063 } 1064 } 1065} 1066 1067impl<'a, S> ViewBuilder<'a, S> 1068where 1069 S: view_state::State, 1070 S::Record: view_state::IsUnset, 1071{ 1072 /// Set the `record` field (required) 1073 pub fn record( 1074 mut self, 1075 value: impl Into<ViewUnionRecord<'a>>, 1076 ) -> ViewBuilder<'a, view_state::SetRecord<S>> { 1077 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1078 ViewBuilder { 1079 _phantom_state: ::core::marker::PhantomData, 1080 __unsafe_private_named: self.__unsafe_private_named, 1081 _phantom: ::core::marker::PhantomData, 1082 } 1083 } 1084} 1085 1086impl<'a, S> ViewBuilder<'a, S> 1087where 1088 S: view_state::State, 1089 S::Record: view_state::IsSet, 1090{ 1091 /// Build the final struct 1092 pub fn build(self) -> View<'a> { 1093 View { 1094 record: self.__unsafe_private_named.0.unwrap(), 1095 extra_data: Default::default(), 1096 } 1097 } 1098 /// Build the final struct with custom extra_data 1099 pub fn build_with_data( 1100 self, 1101 extra_data: std::collections::BTreeMap< 1102 jacquard_common::smol_str::SmolStr, 1103 jacquard_common::types::value::Data<'a>, 1104 >, 1105 ) -> View<'a> { 1106 View { 1107 record: self.__unsafe_private_named.0.unwrap(), 1108 extra_data: Some(extra_data), 1109 } 1110 } 1111} 1112 1113#[jacquard_derive::open_union] 1114#[derive( 1115 serde::Serialize, 1116 serde::Deserialize, 1117 Debug, 1118 Clone, 1119 PartialEq, 1120 Eq, 1121 jacquard_derive::IntoStatic 1122)] 1123#[serde(tag = "$type")] 1124#[serde(bound(deserialize = "'de: 'a"))] 1125pub enum ViewUnionRecord<'a> { 1126 #[serde(rename = "sh.weaver.embed.records#viewRecord")] 1127 ViewRecord(Box<crate::sh_weaver::embed::records::ViewRecord<'a>>), 1128 #[serde(rename = "sh.weaver.embed.records#viewNotFound")] 1129 ViewNotFound(Box<crate::sh_weaver::embed::records::ViewNotFound<'a>>), 1130 #[serde(rename = "sh.weaver.embed.records#viewBlocked")] 1131 ViewBlocked(Box<crate::sh_weaver::embed::records::ViewBlocked<'a>>), 1132 #[serde(rename = "sh.weaver.embed.records#viewDetached")] 1133 ViewDetached(Box<crate::sh_weaver::embed::records::ViewDetached<'a>>), 1134 #[serde(rename = "app.bsky.feed.defs#generatorView")] 1135 GeneratorView(Box<crate::app_bsky::feed::GeneratorView<'a>>), 1136 #[serde(rename = "app.bsky.graph.defs#listView")] 1137 ListView(Box<crate::app_bsky::graph::ListView<'a>>), 1138 #[serde(rename = "app.bsky.labeler.defs#labelerView")] 1139 LabelerView(Box<crate::app_bsky::labeler::LabelerView<'a>>), 1140 #[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")] 1141 StarterPackViewBasic(Box<crate::app_bsky::graph::StarterPackViewBasic<'a>>), 1142} 1143 1144impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { 1145 fn nsid() -> &'static str { 1146 "sh.weaver.embed.records" 1147 } 1148 fn def_name() -> &'static str { 1149 "view" 1150 } 1151 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1152 lexicon_doc_sh_weaver_embed_records() 1153 } 1154 fn validate( 1155 &self, 1156 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1157 Ok(()) 1158 } 1159} 1160 1161#[jacquard_derive::lexicon] 1162#[derive( 1163 serde::Serialize, 1164 serde::Deserialize, 1165 Debug, 1166 Clone, 1167 PartialEq, 1168 Eq, 1169 jacquard_derive::IntoStatic 1170)] 1171#[serde(rename_all = "camelCase")] 1172pub struct ViewBlocked<'a> { 1173 #[serde(borrow)] 1174 pub author: crate::app_bsky::feed::BlockedAuthor<'a>, 1175 pub blocked: bool, 1176 #[serde(borrow)] 1177 pub uri: jacquard_common::types::string::AtUri<'a>, 1178} 1179 1180pub mod view_blocked_state { 1181 1182 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1183 #[allow(unused)] 1184 use ::core::marker::PhantomData; 1185 mod sealed { 1186 pub trait Sealed {} 1187 } 1188 /// State trait tracking which required fields have been set 1189 pub trait State: sealed::Sealed { 1190 type Uri; 1191 type Author; 1192 type Blocked; 1193 } 1194 /// Empty state - all required fields are unset 1195 pub struct Empty(()); 1196 impl sealed::Sealed for Empty {} 1197 impl State for Empty { 1198 type Uri = Unset; 1199 type Author = Unset; 1200 type Blocked = Unset; 1201 } 1202 ///State transition - sets the `uri` field to Set 1203 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1204 impl<S: State> sealed::Sealed for SetUri<S> {} 1205 impl<S: State> State for SetUri<S> { 1206 type Uri = Set<members::uri>; 1207 type Author = S::Author; 1208 type Blocked = S::Blocked; 1209 } 1210 ///State transition - sets the `author` field to Set 1211 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); 1212 impl<S: State> sealed::Sealed for SetAuthor<S> {} 1213 impl<S: State> State for SetAuthor<S> { 1214 type Uri = S::Uri; 1215 type Author = Set<members::author>; 1216 type Blocked = S::Blocked; 1217 } 1218 ///State transition - sets the `blocked` field to Set 1219 pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>); 1220 impl<S: State> sealed::Sealed for SetBlocked<S> {} 1221 impl<S: State> State for SetBlocked<S> { 1222 type Uri = S::Uri; 1223 type Author = S::Author; 1224 type Blocked = Set<members::blocked>; 1225 } 1226 /// Marker types for field names 1227 #[allow(non_camel_case_types)] 1228 pub mod members { 1229 ///Marker type for the `uri` field 1230 pub struct uri(()); 1231 ///Marker type for the `author` field 1232 pub struct author(()); 1233 ///Marker type for the `blocked` field 1234 pub struct blocked(()); 1235 } 1236} 1237 1238/// Builder for constructing an instance of this type 1239pub struct ViewBlockedBuilder<'a, S: view_blocked_state::State> { 1240 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1241 __unsafe_private_named: ( 1242 ::core::option::Option<crate::app_bsky::feed::BlockedAuthor<'a>>, 1243 ::core::option::Option<bool>, 1244 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1245 ), 1246 _phantom: ::core::marker::PhantomData<&'a ()>, 1247} 1248 1249impl<'a> ViewBlocked<'a> { 1250 /// Create a new builder for this type 1251 pub fn new() -> ViewBlockedBuilder<'a, view_blocked_state::Empty> { 1252 ViewBlockedBuilder::new() 1253 } 1254} 1255 1256impl<'a> ViewBlockedBuilder<'a, view_blocked_state::Empty> { 1257 /// Create a new builder with all fields unset 1258 pub fn new() -> Self { 1259 ViewBlockedBuilder { 1260 _phantom_state: ::core::marker::PhantomData, 1261 __unsafe_private_named: (None, None, None), 1262 _phantom: ::core::marker::PhantomData, 1263 } 1264 } 1265} 1266 1267impl<'a, S> ViewBlockedBuilder<'a, S> 1268where 1269 S: view_blocked_state::State, 1270 S::Author: view_blocked_state::IsUnset, 1271{ 1272 /// Set the `author` field (required) 1273 pub fn author( 1274 mut self, 1275 value: impl Into<crate::app_bsky::feed::BlockedAuthor<'a>>, 1276 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetAuthor<S>> { 1277 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1278 ViewBlockedBuilder { 1279 _phantom_state: ::core::marker::PhantomData, 1280 __unsafe_private_named: self.__unsafe_private_named, 1281 _phantom: ::core::marker::PhantomData, 1282 } 1283 } 1284} 1285 1286impl<'a, S> ViewBlockedBuilder<'a, S> 1287where 1288 S: view_blocked_state::State, 1289 S::Blocked: view_blocked_state::IsUnset, 1290{ 1291 /// Set the `blocked` field (required) 1292 pub fn blocked( 1293 mut self, 1294 value: impl Into<bool>, 1295 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetBlocked<S>> { 1296 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1297 ViewBlockedBuilder { 1298 _phantom_state: ::core::marker::PhantomData, 1299 __unsafe_private_named: self.__unsafe_private_named, 1300 _phantom: ::core::marker::PhantomData, 1301 } 1302 } 1303} 1304 1305impl<'a, S> ViewBlockedBuilder<'a, S> 1306where 1307 S: view_blocked_state::State, 1308 S::Uri: view_blocked_state::IsUnset, 1309{ 1310 /// Set the `uri` field (required) 1311 pub fn uri( 1312 mut self, 1313 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1314 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetUri<S>> { 1315 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 1316 ViewBlockedBuilder { 1317 _phantom_state: ::core::marker::PhantomData, 1318 __unsafe_private_named: self.__unsafe_private_named, 1319 _phantom: ::core::marker::PhantomData, 1320 } 1321 } 1322} 1323 1324impl<'a, S> ViewBlockedBuilder<'a, S> 1325where 1326 S: view_blocked_state::State, 1327 S::Uri: view_blocked_state::IsSet, 1328 S::Author: view_blocked_state::IsSet, 1329 S::Blocked: view_blocked_state::IsSet, 1330{ 1331 /// Build the final struct 1332 pub fn build(self) -> ViewBlocked<'a> { 1333 ViewBlocked { 1334 author: self.__unsafe_private_named.0.unwrap(), 1335 blocked: self.__unsafe_private_named.1.unwrap(), 1336 uri: self.__unsafe_private_named.2.unwrap(), 1337 extra_data: Default::default(), 1338 } 1339 } 1340 /// Build the final struct with custom extra_data 1341 pub fn build_with_data( 1342 self, 1343 extra_data: std::collections::BTreeMap< 1344 jacquard_common::smol_str::SmolStr, 1345 jacquard_common::types::value::Data<'a>, 1346 >, 1347 ) -> ViewBlocked<'a> { 1348 ViewBlocked { 1349 author: self.__unsafe_private_named.0.unwrap(), 1350 blocked: self.__unsafe_private_named.1.unwrap(), 1351 uri: self.__unsafe_private_named.2.unwrap(), 1352 extra_data: Some(extra_data), 1353 } 1354 } 1355} 1356 1357impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewBlocked<'a> { 1358 fn nsid() -> &'static str { 1359 "sh.weaver.embed.records" 1360 } 1361 fn def_name() -> &'static str { 1362 "viewBlocked" 1363 } 1364 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1365 lexicon_doc_sh_weaver_embed_records() 1366 } 1367 fn validate( 1368 &self, 1369 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1370 Ok(()) 1371 } 1372} 1373 1374#[jacquard_derive::lexicon] 1375#[derive( 1376 serde::Serialize, 1377 serde::Deserialize, 1378 Debug, 1379 Clone, 1380 PartialEq, 1381 Eq, 1382 jacquard_derive::IntoStatic 1383)] 1384#[serde(rename_all = "camelCase")] 1385pub struct ViewDetached<'a> { 1386 pub detached: bool, 1387 #[serde(borrow)] 1388 pub uri: jacquard_common::types::string::AtUri<'a>, 1389} 1390 1391pub mod view_detached_state { 1392 1393 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1394 #[allow(unused)] 1395 use ::core::marker::PhantomData; 1396 mod sealed { 1397 pub trait Sealed {} 1398 } 1399 /// State trait tracking which required fields have been set 1400 pub trait State: sealed::Sealed { 1401 type Detached; 1402 type Uri; 1403 } 1404 /// Empty state - all required fields are unset 1405 pub struct Empty(()); 1406 impl sealed::Sealed for Empty {} 1407 impl State for Empty { 1408 type Detached = Unset; 1409 type Uri = Unset; 1410 } 1411 ///State transition - sets the `detached` field to Set 1412 pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>); 1413 impl<S: State> sealed::Sealed for SetDetached<S> {} 1414 impl<S: State> State for SetDetached<S> { 1415 type Detached = Set<members::detached>; 1416 type Uri = S::Uri; 1417 } 1418 ///State transition - sets the `uri` field to Set 1419 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1420 impl<S: State> sealed::Sealed for SetUri<S> {} 1421 impl<S: State> State for SetUri<S> { 1422 type Detached = S::Detached; 1423 type Uri = Set<members::uri>; 1424 } 1425 /// Marker types for field names 1426 #[allow(non_camel_case_types)] 1427 pub mod members { 1428 ///Marker type for the `detached` field 1429 pub struct detached(()); 1430 ///Marker type for the `uri` field 1431 pub struct uri(()); 1432 } 1433} 1434 1435/// Builder for constructing an instance of this type 1436pub struct ViewDetachedBuilder<'a, S: view_detached_state::State> { 1437 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1438 __unsafe_private_named: ( 1439 ::core::option::Option<bool>, 1440 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1441 ), 1442 _phantom: ::core::marker::PhantomData<&'a ()>, 1443} 1444 1445impl<'a> ViewDetached<'a> { 1446 /// Create a new builder for this type 1447 pub fn new() -> ViewDetachedBuilder<'a, view_detached_state::Empty> { 1448 ViewDetachedBuilder::new() 1449 } 1450} 1451 1452impl<'a> ViewDetachedBuilder<'a, view_detached_state::Empty> { 1453 /// Create a new builder with all fields unset 1454 pub fn new() -> Self { 1455 ViewDetachedBuilder { 1456 _phantom_state: ::core::marker::PhantomData, 1457 __unsafe_private_named: (None, None), 1458 _phantom: ::core::marker::PhantomData, 1459 } 1460 } 1461} 1462 1463impl<'a, S> ViewDetachedBuilder<'a, S> 1464where 1465 S: view_detached_state::State, 1466 S::Detached: view_detached_state::IsUnset, 1467{ 1468 /// Set the `detached` field (required) 1469 pub fn detached( 1470 mut self, 1471 value: impl Into<bool>, 1472 ) -> ViewDetachedBuilder<'a, view_detached_state::SetDetached<S>> { 1473 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1474 ViewDetachedBuilder { 1475 _phantom_state: ::core::marker::PhantomData, 1476 __unsafe_private_named: self.__unsafe_private_named, 1477 _phantom: ::core::marker::PhantomData, 1478 } 1479 } 1480} 1481 1482impl<'a, S> ViewDetachedBuilder<'a, S> 1483where 1484 S: view_detached_state::State, 1485 S::Uri: view_detached_state::IsUnset, 1486{ 1487 /// Set the `uri` field (required) 1488 pub fn uri( 1489 mut self, 1490 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1491 ) -> ViewDetachedBuilder<'a, view_detached_state::SetUri<S>> { 1492 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1493 ViewDetachedBuilder { 1494 _phantom_state: ::core::marker::PhantomData, 1495 __unsafe_private_named: self.__unsafe_private_named, 1496 _phantom: ::core::marker::PhantomData, 1497 } 1498 } 1499} 1500 1501impl<'a, S> ViewDetachedBuilder<'a, S> 1502where 1503 S: view_detached_state::State, 1504 S::Detached: view_detached_state::IsSet, 1505 S::Uri: view_detached_state::IsSet, 1506{ 1507 /// Build the final struct 1508 pub fn build(self) -> ViewDetached<'a> { 1509 ViewDetached { 1510 detached: self.__unsafe_private_named.0.unwrap(), 1511 uri: self.__unsafe_private_named.1.unwrap(), 1512 extra_data: Default::default(), 1513 } 1514 } 1515 /// Build the final struct with custom extra_data 1516 pub fn build_with_data( 1517 self, 1518 extra_data: std::collections::BTreeMap< 1519 jacquard_common::smol_str::SmolStr, 1520 jacquard_common::types::value::Data<'a>, 1521 >, 1522 ) -> ViewDetached<'a> { 1523 ViewDetached { 1524 detached: self.__unsafe_private_named.0.unwrap(), 1525 uri: self.__unsafe_private_named.1.unwrap(), 1526 extra_data: Some(extra_data), 1527 } 1528 } 1529} 1530 1531impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewDetached<'a> { 1532 fn nsid() -> &'static str { 1533 "sh.weaver.embed.records" 1534 } 1535 fn def_name() -> &'static str { 1536 "viewDetached" 1537 } 1538 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1539 lexicon_doc_sh_weaver_embed_records() 1540 } 1541 fn validate( 1542 &self, 1543 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1544 Ok(()) 1545 } 1546} 1547 1548#[jacquard_derive::lexicon] 1549#[derive( 1550 serde::Serialize, 1551 serde::Deserialize, 1552 Debug, 1553 Clone, 1554 PartialEq, 1555 Eq, 1556 jacquard_derive::IntoStatic 1557)] 1558#[serde(rename_all = "camelCase")] 1559pub struct ViewNotFound<'a> { 1560 pub not_found: bool, 1561 #[serde(borrow)] 1562 pub uri: jacquard_common::types::string::AtUri<'a>, 1563} 1564 1565pub mod view_not_found_state { 1566 1567 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1568 #[allow(unused)] 1569 use ::core::marker::PhantomData; 1570 mod sealed { 1571 pub trait Sealed {} 1572 } 1573 /// State trait tracking which required fields have been set 1574 pub trait State: sealed::Sealed { 1575 type NotFound; 1576 type Uri; 1577 } 1578 /// Empty state - all required fields are unset 1579 pub struct Empty(()); 1580 impl sealed::Sealed for Empty {} 1581 impl State for Empty { 1582 type NotFound = Unset; 1583 type Uri = Unset; 1584 } 1585 ///State transition - sets the `not_found` field to Set 1586 pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>); 1587 impl<S: State> sealed::Sealed for SetNotFound<S> {} 1588 impl<S: State> State for SetNotFound<S> { 1589 type NotFound = Set<members::not_found>; 1590 type Uri = S::Uri; 1591 } 1592 ///State transition - sets the `uri` field to Set 1593 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1594 impl<S: State> sealed::Sealed for SetUri<S> {} 1595 impl<S: State> State for SetUri<S> { 1596 type NotFound = S::NotFound; 1597 type Uri = Set<members::uri>; 1598 } 1599 /// Marker types for field names 1600 #[allow(non_camel_case_types)] 1601 pub mod members { 1602 ///Marker type for the `not_found` field 1603 pub struct not_found(()); 1604 ///Marker type for the `uri` field 1605 pub struct uri(()); 1606 } 1607} 1608 1609/// Builder for constructing an instance of this type 1610pub struct ViewNotFoundBuilder<'a, S: view_not_found_state::State> { 1611 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1612 __unsafe_private_named: ( 1613 ::core::option::Option<bool>, 1614 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1615 ), 1616 _phantom: ::core::marker::PhantomData<&'a ()>, 1617} 1618 1619impl<'a> ViewNotFound<'a> { 1620 /// Create a new builder for this type 1621 pub fn new() -> ViewNotFoundBuilder<'a, view_not_found_state::Empty> { 1622 ViewNotFoundBuilder::new() 1623 } 1624} 1625 1626impl<'a> ViewNotFoundBuilder<'a, view_not_found_state::Empty> { 1627 /// Create a new builder with all fields unset 1628 pub fn new() -> Self { 1629 ViewNotFoundBuilder { 1630 _phantom_state: ::core::marker::PhantomData, 1631 __unsafe_private_named: (None, None), 1632 _phantom: ::core::marker::PhantomData, 1633 } 1634 } 1635} 1636 1637impl<'a, S> ViewNotFoundBuilder<'a, S> 1638where 1639 S: view_not_found_state::State, 1640 S::NotFound: view_not_found_state::IsUnset, 1641{ 1642 /// Set the `notFound` field (required) 1643 pub fn not_found( 1644 mut self, 1645 value: impl Into<bool>, 1646 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetNotFound<S>> { 1647 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1648 ViewNotFoundBuilder { 1649 _phantom_state: ::core::marker::PhantomData, 1650 __unsafe_private_named: self.__unsafe_private_named, 1651 _phantom: ::core::marker::PhantomData, 1652 } 1653 } 1654} 1655 1656impl<'a, S> ViewNotFoundBuilder<'a, S> 1657where 1658 S: view_not_found_state::State, 1659 S::Uri: view_not_found_state::IsUnset, 1660{ 1661 /// Set the `uri` field (required) 1662 pub fn uri( 1663 mut self, 1664 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1665 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetUri<S>> { 1666 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1667 ViewNotFoundBuilder { 1668 _phantom_state: ::core::marker::PhantomData, 1669 __unsafe_private_named: self.__unsafe_private_named, 1670 _phantom: ::core::marker::PhantomData, 1671 } 1672 } 1673} 1674 1675impl<'a, S> ViewNotFoundBuilder<'a, S> 1676where 1677 S: view_not_found_state::State, 1678 S::NotFound: view_not_found_state::IsSet, 1679 S::Uri: view_not_found_state::IsSet, 1680{ 1681 /// Build the final struct 1682 pub fn build(self) -> ViewNotFound<'a> { 1683 ViewNotFound { 1684 not_found: self.__unsafe_private_named.0.unwrap(), 1685 uri: self.__unsafe_private_named.1.unwrap(), 1686 extra_data: Default::default(), 1687 } 1688 } 1689 /// Build the final struct with custom extra_data 1690 pub fn build_with_data( 1691 self, 1692 extra_data: std::collections::BTreeMap< 1693 jacquard_common::smol_str::SmolStr, 1694 jacquard_common::types::value::Data<'a>, 1695 >, 1696 ) -> ViewNotFound<'a> { 1697 ViewNotFound { 1698 not_found: self.__unsafe_private_named.0.unwrap(), 1699 uri: self.__unsafe_private_named.1.unwrap(), 1700 extra_data: Some(extra_data), 1701 } 1702 } 1703} 1704 1705impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewNotFound<'a> { 1706 fn nsid() -> &'static str { 1707 "sh.weaver.embed.records" 1708 } 1709 fn def_name() -> &'static str { 1710 "viewNotFound" 1711 } 1712 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1713 lexicon_doc_sh_weaver_embed_records() 1714 } 1715 fn validate( 1716 &self, 1717 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1718 Ok(()) 1719 } 1720} 1721 1722#[jacquard_derive::lexicon] 1723#[derive( 1724 serde::Serialize, 1725 serde::Deserialize, 1726 Debug, 1727 Clone, 1728 PartialEq, 1729 Eq, 1730 jacquard_derive::IntoStatic 1731)] 1732#[serde(rename_all = "camelCase")] 1733pub struct ViewRecord<'a> { 1734 #[serde(borrow)] 1735 pub author: crate::sh_weaver::actor::ProfileDataViewBasic<'a>, 1736 #[serde(borrow)] 1737 pub cid: jacquard_common::types::string::Cid<'a>, 1738 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1739 #[serde(borrow)] 1740 pub embeds: std::option::Option< 1741 Vec<crate::sh_weaver::embed::records::RecordEmbedView<'a>>, 1742 >, 1743 pub indexed_at: jacquard_common::types::string::Datetime, 1744 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1745 #[serde(borrow)] 1746 pub labels: std::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 1747 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1748 pub like_count: std::option::Option<i64>, 1749 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1750 pub quote_count: std::option::Option<i64>, 1751 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1752 pub reply_count: std::option::Option<i64>, 1753 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1754 pub repost_count: std::option::Option<i64>, 1755 #[serde(borrow)] 1756 pub uri: jacquard_common::types::string::AtUri<'a>, 1757 /// The record data itself. 1758 #[serde(borrow)] 1759 pub value: jacquard_common::types::value::Data<'a>, 1760} 1761 1762pub mod view_record_state { 1763 1764 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1765 #[allow(unused)] 1766 use ::core::marker::PhantomData; 1767 mod sealed { 1768 pub trait Sealed {} 1769 } 1770 /// State trait tracking which required fields have been set 1771 pub trait State: sealed::Sealed { 1772 type Uri; 1773 type Cid; 1774 type Author; 1775 type Value; 1776 type IndexedAt; 1777 } 1778 /// Empty state - all required fields are unset 1779 pub struct Empty(()); 1780 impl sealed::Sealed for Empty {} 1781 impl State for Empty { 1782 type Uri = Unset; 1783 type Cid = Unset; 1784 type Author = Unset; 1785 type Value = Unset; 1786 type IndexedAt = Unset; 1787 } 1788 ///State transition - sets the `uri` field to Set 1789 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1790 impl<S: State> sealed::Sealed for SetUri<S> {} 1791 impl<S: State> State for SetUri<S> { 1792 type Uri = Set<members::uri>; 1793 type Cid = S::Cid; 1794 type Author = S::Author; 1795 type Value = S::Value; 1796 type IndexedAt = S::IndexedAt; 1797 } 1798 ///State transition - sets the `cid` field to Set 1799 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 1800 impl<S: State> sealed::Sealed for SetCid<S> {} 1801 impl<S: State> State for SetCid<S> { 1802 type Uri = S::Uri; 1803 type Cid = Set<members::cid>; 1804 type Author = S::Author; 1805 type Value = S::Value; 1806 type IndexedAt = S::IndexedAt; 1807 } 1808 ///State transition - sets the `author` field to Set 1809 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); 1810 impl<S: State> sealed::Sealed for SetAuthor<S> {} 1811 impl<S: State> State for SetAuthor<S> { 1812 type Uri = S::Uri; 1813 type Cid = S::Cid; 1814 type Author = Set<members::author>; 1815 type Value = S::Value; 1816 type IndexedAt = S::IndexedAt; 1817 } 1818 ///State transition - sets the `value` field to Set 1819 pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); 1820 impl<S: State> sealed::Sealed for SetValue<S> {} 1821 impl<S: State> State for SetValue<S> { 1822 type Uri = S::Uri; 1823 type Cid = S::Cid; 1824 type Author = S::Author; 1825 type Value = Set<members::value>; 1826 type IndexedAt = S::IndexedAt; 1827 } 1828 ///State transition - sets the `indexed_at` field to Set 1829 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); 1830 impl<S: State> sealed::Sealed for SetIndexedAt<S> {} 1831 impl<S: State> State for SetIndexedAt<S> { 1832 type Uri = S::Uri; 1833 type Cid = S::Cid; 1834 type Author = S::Author; 1835 type Value = S::Value; 1836 type IndexedAt = Set<members::indexed_at>; 1837 } 1838 /// Marker types for field names 1839 #[allow(non_camel_case_types)] 1840 pub mod members { 1841 ///Marker type for the `uri` field 1842 pub struct uri(()); 1843 ///Marker type for the `cid` field 1844 pub struct cid(()); 1845 ///Marker type for the `author` field 1846 pub struct author(()); 1847 ///Marker type for the `value` field 1848 pub struct value(()); 1849 ///Marker type for the `indexed_at` field 1850 pub struct indexed_at(()); 1851 } 1852} 1853 1854/// Builder for constructing an instance of this type 1855pub struct ViewRecordBuilder<'a, S: view_record_state::State> { 1856 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1857 __unsafe_private_named: ( 1858 ::core::option::Option<crate::sh_weaver::actor::ProfileDataViewBasic<'a>>, 1859 ::core::option::Option<jacquard_common::types::string::Cid<'a>>, 1860 ::core::option::Option< 1861 Vec<crate::sh_weaver::embed::records::RecordEmbedView<'a>>, 1862 >, 1863 ::core::option::Option<jacquard_common::types::string::Datetime>, 1864 ::core::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 1865 ::core::option::Option<i64>, 1866 ::core::option::Option<i64>, 1867 ::core::option::Option<i64>, 1868 ::core::option::Option<i64>, 1869 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1870 ::core::option::Option<jacquard_common::types::value::Data<'a>>, 1871 ), 1872 _phantom: ::core::marker::PhantomData<&'a ()>, 1873} 1874 1875impl<'a> ViewRecord<'a> { 1876 /// Create a new builder for this type 1877 pub fn new() -> ViewRecordBuilder<'a, view_record_state::Empty> { 1878 ViewRecordBuilder::new() 1879 } 1880} 1881 1882impl<'a> ViewRecordBuilder<'a, view_record_state::Empty> { 1883 /// Create a new builder with all fields unset 1884 pub fn new() -> Self { 1885 ViewRecordBuilder { 1886 _phantom_state: ::core::marker::PhantomData, 1887 __unsafe_private_named: ( 1888 None, 1889 None, 1890 None, 1891 None, 1892 None, 1893 None, 1894 None, 1895 None, 1896 None, 1897 None, 1898 None, 1899 ), 1900 _phantom: ::core::marker::PhantomData, 1901 } 1902 } 1903} 1904 1905impl<'a, S> ViewRecordBuilder<'a, S> 1906where 1907 S: view_record_state::State, 1908 S::Author: view_record_state::IsUnset, 1909{ 1910 /// Set the `author` field (required) 1911 pub fn author( 1912 mut self, 1913 value: impl Into<crate::sh_weaver::actor::ProfileDataViewBasic<'a>>, 1914 ) -> ViewRecordBuilder<'a, view_record_state::SetAuthor<S>> { 1915 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1916 ViewRecordBuilder { 1917 _phantom_state: ::core::marker::PhantomData, 1918 __unsafe_private_named: self.__unsafe_private_named, 1919 _phantom: ::core::marker::PhantomData, 1920 } 1921 } 1922} 1923 1924impl<'a, S> ViewRecordBuilder<'a, S> 1925where 1926 S: view_record_state::State, 1927 S::Cid: view_record_state::IsUnset, 1928{ 1929 /// Set the `cid` field (required) 1930 pub fn cid( 1931 mut self, 1932 value: impl Into<jacquard_common::types::string::Cid<'a>>, 1933 ) -> ViewRecordBuilder<'a, view_record_state::SetCid<S>> { 1934 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1935 ViewRecordBuilder { 1936 _phantom_state: ::core::marker::PhantomData, 1937 __unsafe_private_named: self.__unsafe_private_named, 1938 _phantom: ::core::marker::PhantomData, 1939 } 1940 } 1941} 1942 1943impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1944 /// Set the `embeds` field (optional) 1945 pub fn embeds( 1946 mut self, 1947 value: impl Into< 1948 Option<Vec<crate::sh_weaver::embed::records::RecordEmbedView<'a>>>, 1949 >, 1950 ) -> Self { 1951 self.__unsafe_private_named.2 = value.into(); 1952 self 1953 } 1954 /// Set the `embeds` field to an Option value (optional) 1955 pub fn maybe_embeds( 1956 mut self, 1957 value: Option<Vec<crate::sh_weaver::embed::records::RecordEmbedView<'a>>>, 1958 ) -> Self { 1959 self.__unsafe_private_named.2 = value; 1960 self 1961 } 1962} 1963 1964impl<'a, S> ViewRecordBuilder<'a, S> 1965where 1966 S: view_record_state::State, 1967 S::IndexedAt: view_record_state::IsUnset, 1968{ 1969 /// Set the `indexedAt` field (required) 1970 pub fn indexed_at( 1971 mut self, 1972 value: impl Into<jacquard_common::types::string::Datetime>, 1973 ) -> ViewRecordBuilder<'a, view_record_state::SetIndexedAt<S>> { 1974 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); 1975 ViewRecordBuilder { 1976 _phantom_state: ::core::marker::PhantomData, 1977 __unsafe_private_named: self.__unsafe_private_named, 1978 _phantom: ::core::marker::PhantomData, 1979 } 1980 } 1981} 1982 1983impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1984 /// Set the `labels` field (optional) 1985 pub fn labels( 1986 mut self, 1987 value: impl Into<Option<Vec<crate::com_atproto::label::Label<'a>>>>, 1988 ) -> Self { 1989 self.__unsafe_private_named.4 = value.into(); 1990 self 1991 } 1992 /// Set the `labels` field to an Option value (optional) 1993 pub fn maybe_labels( 1994 mut self, 1995 value: Option<Vec<crate::com_atproto::label::Label<'a>>>, 1996 ) -> Self { 1997 self.__unsafe_private_named.4 = value; 1998 self 1999 } 2000} 2001 2002impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 2003 /// Set the `likeCount` field (optional) 2004 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self { 2005 self.__unsafe_private_named.5 = value.into(); 2006 self 2007 } 2008 /// Set the `likeCount` field to an Option value (optional) 2009 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self { 2010 self.__unsafe_private_named.5 = value; 2011 self 2012 } 2013} 2014 2015impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 2016 /// Set the `quoteCount` field (optional) 2017 pub fn quote_count(mut self, value: impl Into<Option<i64>>) -> Self { 2018 self.__unsafe_private_named.6 = value.into(); 2019 self 2020 } 2021 /// Set the `quoteCount` field to an Option value (optional) 2022 pub fn maybe_quote_count(mut self, value: Option<i64>) -> Self { 2023 self.__unsafe_private_named.6 = value; 2024 self 2025 } 2026} 2027 2028impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 2029 /// Set the `replyCount` field (optional) 2030 pub fn reply_count(mut self, value: impl Into<Option<i64>>) -> Self { 2031 self.__unsafe_private_named.7 = value.into(); 2032 self 2033 } 2034 /// Set the `replyCount` field to an Option value (optional) 2035 pub fn maybe_reply_count(mut self, value: Option<i64>) -> Self { 2036 self.__unsafe_private_named.7 = value; 2037 self 2038 } 2039} 2040 2041impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 2042 /// Set the `repostCount` field (optional) 2043 pub fn repost_count(mut self, value: impl Into<Option<i64>>) -> Self { 2044 self.__unsafe_private_named.8 = value.into(); 2045 self 2046 } 2047 /// Set the `repostCount` field to an Option value (optional) 2048 pub fn maybe_repost_count(mut self, value: Option<i64>) -> Self { 2049 self.__unsafe_private_named.8 = value; 2050 self 2051 } 2052} 2053 2054impl<'a, S> ViewRecordBuilder<'a, S> 2055where 2056 S: view_record_state::State, 2057 S::Uri: view_record_state::IsUnset, 2058{ 2059 /// Set the `uri` field (required) 2060 pub fn uri( 2061 mut self, 2062 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 2063 ) -> ViewRecordBuilder<'a, view_record_state::SetUri<S>> { 2064 self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); 2065 ViewRecordBuilder { 2066 _phantom_state: ::core::marker::PhantomData, 2067 __unsafe_private_named: self.__unsafe_private_named, 2068 _phantom: ::core::marker::PhantomData, 2069 } 2070 } 2071} 2072 2073impl<'a, S> ViewRecordBuilder<'a, S> 2074where 2075 S: view_record_state::State, 2076 S::Value: view_record_state::IsUnset, 2077{ 2078 /// Set the `value` field (required) 2079 pub fn value( 2080 mut self, 2081 value: impl Into<jacquard_common::types::value::Data<'a>>, 2082 ) -> ViewRecordBuilder<'a, view_record_state::SetValue<S>> { 2083 self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into()); 2084 ViewRecordBuilder { 2085 _phantom_state: ::core::marker::PhantomData, 2086 __unsafe_private_named: self.__unsafe_private_named, 2087 _phantom: ::core::marker::PhantomData, 2088 } 2089 } 2090} 2091 2092impl<'a, S> ViewRecordBuilder<'a, S> 2093where 2094 S: view_record_state::State, 2095 S::Uri: view_record_state::IsSet, 2096 S::Cid: view_record_state::IsSet, 2097 S::Author: view_record_state::IsSet, 2098 S::Value: view_record_state::IsSet, 2099 S::IndexedAt: view_record_state::IsSet, 2100{ 2101 /// Build the final struct 2102 pub fn build(self) -> ViewRecord<'a> { 2103 ViewRecord { 2104 author: self.__unsafe_private_named.0.unwrap(), 2105 cid: self.__unsafe_private_named.1.unwrap(), 2106 embeds: self.__unsafe_private_named.2, 2107 indexed_at: self.__unsafe_private_named.3.unwrap(), 2108 labels: self.__unsafe_private_named.4, 2109 like_count: self.__unsafe_private_named.5, 2110 quote_count: self.__unsafe_private_named.6, 2111 reply_count: self.__unsafe_private_named.7, 2112 repost_count: self.__unsafe_private_named.8, 2113 uri: self.__unsafe_private_named.9.unwrap(), 2114 value: self.__unsafe_private_named.10.unwrap(), 2115 extra_data: Default::default(), 2116 } 2117 } 2118 /// Build the final struct with custom extra_data 2119 pub fn build_with_data( 2120 self, 2121 extra_data: std::collections::BTreeMap< 2122 jacquard_common::smol_str::SmolStr, 2123 jacquard_common::types::value::Data<'a>, 2124 >, 2125 ) -> ViewRecord<'a> { 2126 ViewRecord { 2127 author: self.__unsafe_private_named.0.unwrap(), 2128 cid: self.__unsafe_private_named.1.unwrap(), 2129 embeds: self.__unsafe_private_named.2, 2130 indexed_at: self.__unsafe_private_named.3.unwrap(), 2131 labels: self.__unsafe_private_named.4, 2132 like_count: self.__unsafe_private_named.5, 2133 quote_count: self.__unsafe_private_named.6, 2134 reply_count: self.__unsafe_private_named.7, 2135 repost_count: self.__unsafe_private_named.8, 2136 uri: self.__unsafe_private_named.9.unwrap(), 2137 value: self.__unsafe_private_named.10.unwrap(), 2138 extra_data: Some(extra_data), 2139 } 2140 } 2141} 2142 2143impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewRecord<'a> { 2144 fn nsid() -> &'static str { 2145 "sh.weaver.embed.records" 2146 } 2147 fn def_name() -> &'static str { 2148 "viewRecord" 2149 } 2150 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 2151 lexicon_doc_sh_weaver_embed_records() 2152 } 2153 fn validate( 2154 &self, 2155 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 2156 Ok(()) 2157 } 2158}