atproto blogging
at main 1710 lines 63 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.embed.record 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 Record<'a> { 20 #[serde(borrow)] 21 pub record: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 22} 23 24pub mod record_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 Record; 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 Record = Unset; 41 } 42 ///State transition - sets the `record` field to Set 43 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); 44 impl<S: State> sealed::Sealed for SetRecord<S> {} 45 impl<S: State> State for SetRecord<S> { 46 type Record = Set<members::record>; 47 } 48 /// Marker types for field names 49 #[allow(non_camel_case_types)] 50 pub mod members { 51 ///Marker type for the `record` field 52 pub struct record(()); 53 } 54} 55 56/// Builder for constructing an instance of this type 57pub struct RecordBuilder<'a, S: record_state::State> { 58 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 59 __unsafe_private_named: ( 60 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 61 ), 62 _phantom: ::core::marker::PhantomData<&'a ()>, 63} 64 65impl<'a> Record<'a> { 66 /// Create a new builder for this type 67 pub fn new() -> RecordBuilder<'a, record_state::Empty> { 68 RecordBuilder::new() 69 } 70} 71 72impl<'a> RecordBuilder<'a, record_state::Empty> { 73 /// Create a new builder with all fields unset 74 pub fn new() -> Self { 75 RecordBuilder { 76 _phantom_state: ::core::marker::PhantomData, 77 __unsafe_private_named: (None,), 78 _phantom: ::core::marker::PhantomData, 79 } 80 } 81} 82 83impl<'a, S> RecordBuilder<'a, S> 84where 85 S: record_state::State, 86 S::Record: record_state::IsUnset, 87{ 88 /// Set the `record` field (required) 89 pub fn record( 90 mut self, 91 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 92 ) -> RecordBuilder<'a, record_state::SetRecord<S>> { 93 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 94 RecordBuilder { 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> RecordBuilder<'a, S> 103where 104 S: record_state::State, 105 S::Record: record_state::IsSet, 106{ 107 /// Build the final struct 108 pub fn build(self) -> Record<'a> { 109 Record { 110 record: 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 ) -> Record<'a> { 122 Record { 123 record: self.__unsafe_private_named.0.unwrap(), 124 extra_data: Some(extra_data), 125 } 126 } 127} 128 129fn lexicon_doc_app_bsky_embed_record() -> ::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("app.bsky.embed.record"), 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("record")], 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("record"), 152 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 153 description: None, 154 r#ref: ::jacquard_common::CowStr::new_static( 155 "com.atproto.repo.strongRef", 156 ), 157 }), 158 ); 159 map 160 }, 161 }), 162 ); 163 map.insert( 164 ::jacquard_common::smol_str::SmolStr::new_static("view"), 165 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 166 description: None, 167 required: Some( 168 vec![::jacquard_common::smol_str::SmolStr::new_static("record")], 169 ), 170 nullable: None, 171 properties: { 172 #[allow(unused_mut)] 173 let mut map = ::alloc::collections::BTreeMap::new(); 174 map.insert( 175 ::jacquard_common::smol_str::SmolStr::new_static("record"), 176 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 177 description: None, 178 refs: vec![ 179 ::jacquard_common::CowStr::new_static("#viewRecord"), 180 ::jacquard_common::CowStr::new_static("#viewNotFound"), 181 ::jacquard_common::CowStr::new_static("#viewBlocked"), 182 ::jacquard_common::CowStr::new_static("#viewDetached"), 183 ::jacquard_common::CowStr::new_static("app.bsky.feed.defs#generatorView"), 184 ::jacquard_common::CowStr::new_static("app.bsky.graph.defs#listView"), 185 ::jacquard_common::CowStr::new_static("app.bsky.labeler.defs#labelerView"), 186 ::jacquard_common::CowStr::new_static("app.bsky.graph.defs#starterPackViewBasic") 187 ], 188 closed: None, 189 }), 190 ); 191 map 192 }, 193 }), 194 ); 195 map.insert( 196 ::jacquard_common::smol_str::SmolStr::new_static("viewBlocked"), 197 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 198 description: None, 199 required: Some( 200 vec![ 201 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 202 ::jacquard_common::smol_str::SmolStr::new_static("blocked"), 203 ::jacquard_common::smol_str::SmolStr::new_static("author") 204 ], 205 ), 206 nullable: None, 207 properties: { 208 #[allow(unused_mut)] 209 let mut map = ::alloc::collections::BTreeMap::new(); 210 map.insert( 211 ::jacquard_common::smol_str::SmolStr::new_static("author"), 212 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 213 description: None, 214 r#ref: ::jacquard_common::CowStr::new_static( 215 "app.bsky.feed.defs#blockedAuthor", 216 ), 217 }), 218 ); 219 map.insert( 220 ::jacquard_common::smol_str::SmolStr::new_static("blocked"), 221 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 222 description: None, 223 default: None, 224 r#const: None, 225 }), 226 ); 227 map.insert( 228 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 229 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 230 description: None, 231 format: Some( 232 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 233 ), 234 default: None, 235 min_length: None, 236 max_length: None, 237 min_graphemes: None, 238 max_graphemes: None, 239 r#enum: None, 240 r#const: None, 241 known_values: None, 242 }), 243 ); 244 map 245 }, 246 }), 247 ); 248 map.insert( 249 ::jacquard_common::smol_str::SmolStr::new_static("viewDetached"), 250 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 251 description: None, 252 required: Some( 253 vec![ 254 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 255 ::jacquard_common::smol_str::SmolStr::new_static("detached") 256 ], 257 ), 258 nullable: None, 259 properties: { 260 #[allow(unused_mut)] 261 let mut map = ::alloc::collections::BTreeMap::new(); 262 map.insert( 263 ::jacquard_common::smol_str::SmolStr::new_static("detached"), 264 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 265 description: None, 266 default: None, 267 r#const: None, 268 }), 269 ); 270 map.insert( 271 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 272 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 273 description: None, 274 format: Some( 275 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 276 ), 277 default: None, 278 min_length: None, 279 max_length: None, 280 min_graphemes: None, 281 max_graphemes: None, 282 r#enum: None, 283 r#const: None, 284 known_values: None, 285 }), 286 ); 287 map 288 }, 289 }), 290 ); 291 map.insert( 292 ::jacquard_common::smol_str::SmolStr::new_static("viewNotFound"), 293 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 294 description: None, 295 required: Some( 296 vec![ 297 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 298 ::jacquard_common::smol_str::SmolStr::new_static("notFound") 299 ], 300 ), 301 nullable: None, 302 properties: { 303 #[allow(unused_mut)] 304 let mut map = ::alloc::collections::BTreeMap::new(); 305 map.insert( 306 ::jacquard_common::smol_str::SmolStr::new_static("notFound"), 307 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 308 description: None, 309 default: None, 310 r#const: None, 311 }), 312 ); 313 map.insert( 314 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 315 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 316 description: None, 317 format: Some( 318 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 319 ), 320 default: None, 321 min_length: None, 322 max_length: None, 323 min_graphemes: None, 324 max_graphemes: None, 325 r#enum: None, 326 r#const: None, 327 known_values: None, 328 }), 329 ); 330 map 331 }, 332 }), 333 ); 334 map.insert( 335 ::jacquard_common::smol_str::SmolStr::new_static("viewRecord"), 336 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 337 description: None, 338 required: Some( 339 vec![ 340 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 341 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 342 ::jacquard_common::smol_str::SmolStr::new_static("author"), 343 ::jacquard_common::smol_str::SmolStr::new_static("value"), 344 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") 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("author"), 353 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 354 description: None, 355 r#ref: ::jacquard_common::CowStr::new_static( 356 "app.bsky.actor.defs#profileViewBasic", 357 ), 358 }), 359 ); 360 map.insert( 361 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 362 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 363 description: None, 364 format: Some( 365 ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 366 ), 367 default: None, 368 min_length: None, 369 max_length: None, 370 min_graphemes: None, 371 max_graphemes: None, 372 r#enum: None, 373 r#const: None, 374 known_values: None, 375 }), 376 ); 377 map.insert( 378 ::jacquard_common::smol_str::SmolStr::new_static("embeds"), 379 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 380 description: None, 381 items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { 382 description: None, 383 refs: vec![ 384 ::jacquard_common::CowStr::new_static("app.bsky.embed.images#view"), 385 ::jacquard_common::CowStr::new_static("app.bsky.embed.video#view"), 386 ::jacquard_common::CowStr::new_static("app.bsky.embed.external#view"), 387 ::jacquard_common::CowStr::new_static("app.bsky.embed.record#view"), 388 ::jacquard_common::CowStr::new_static("app.bsky.embed.recordWithMedia#view") 389 ], 390 closed: None, 391 }), 392 min_length: None, 393 max_length: None, 394 }), 395 ); 396 map.insert( 397 ::jacquard_common::smol_str::SmolStr::new_static( 398 "indexedAt", 399 ), 400 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 401 description: None, 402 format: Some( 403 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 404 ), 405 default: None, 406 min_length: None, 407 max_length: None, 408 min_graphemes: None, 409 max_graphemes: None, 410 r#enum: None, 411 r#const: None, 412 known_values: None, 413 }), 414 ); 415 map.insert( 416 ::jacquard_common::smol_str::SmolStr::new_static("labels"), 417 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 418 description: None, 419 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 420 description: None, 421 r#ref: ::jacquard_common::CowStr::new_static( 422 "com.atproto.label.defs#label", 423 ), 424 }), 425 min_length: None, 426 max_length: None, 427 }), 428 ); 429 map.insert( 430 ::jacquard_common::smol_str::SmolStr::new_static( 431 "likeCount", 432 ), 433 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 434 description: None, 435 default: None, 436 minimum: None, 437 maximum: None, 438 r#enum: None, 439 r#const: None, 440 }), 441 ); 442 map.insert( 443 ::jacquard_common::smol_str::SmolStr::new_static( 444 "quoteCount", 445 ), 446 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 447 description: None, 448 default: None, 449 minimum: None, 450 maximum: None, 451 r#enum: None, 452 r#const: None, 453 }), 454 ); 455 map.insert( 456 ::jacquard_common::smol_str::SmolStr::new_static( 457 "replyCount", 458 ), 459 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 460 description: None, 461 default: None, 462 minimum: None, 463 maximum: None, 464 r#enum: None, 465 r#const: None, 466 }), 467 ); 468 map.insert( 469 ::jacquard_common::smol_str::SmolStr::new_static( 470 "repostCount", 471 ), 472 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 473 description: None, 474 default: None, 475 minimum: None, 476 maximum: None, 477 r#enum: None, 478 r#const: None, 479 }), 480 ); 481 map.insert( 482 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 483 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 484 description: None, 485 format: Some( 486 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 487 ), 488 default: None, 489 min_length: None, 490 max_length: None, 491 min_graphemes: None, 492 max_graphemes: None, 493 r#enum: None, 494 r#const: None, 495 known_values: None, 496 }), 497 ); 498 map.insert( 499 ::jacquard_common::smol_str::SmolStr::new_static("value"), 500 ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { 501 description: None, 502 }), 503 ); 504 map 505 }, 506 }), 507 ); 508 map 509 }, 510 } 511} 512 513impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Record<'a> { 514 fn nsid() -> &'static str { 515 "app.bsky.embed.record" 516 } 517 fn def_name() -> &'static str { 518 "main" 519 } 520 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 521 lexicon_doc_app_bsky_embed_record() 522 } 523 fn validate( 524 &self, 525 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 526 Ok(()) 527 } 528} 529 530#[jacquard_derive::lexicon] 531#[derive( 532 serde::Serialize, 533 serde::Deserialize, 534 Debug, 535 Clone, 536 PartialEq, 537 Eq, 538 jacquard_derive::IntoStatic 539)] 540#[serde(rename_all = "camelCase")] 541pub struct View<'a> { 542 #[serde(borrow)] 543 pub record: ViewUnionRecord<'a>, 544} 545 546pub mod view_state { 547 548 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 549 #[allow(unused)] 550 use ::core::marker::PhantomData; 551 mod sealed { 552 pub trait Sealed {} 553 } 554 /// State trait tracking which required fields have been set 555 pub trait State: sealed::Sealed { 556 type Record; 557 } 558 /// Empty state - all required fields are unset 559 pub struct Empty(()); 560 impl sealed::Sealed for Empty {} 561 impl State for Empty { 562 type Record = Unset; 563 } 564 ///State transition - sets the `record` field to Set 565 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); 566 impl<S: State> sealed::Sealed for SetRecord<S> {} 567 impl<S: State> State for SetRecord<S> { 568 type Record = Set<members::record>; 569 } 570 /// Marker types for field names 571 #[allow(non_camel_case_types)] 572 pub mod members { 573 ///Marker type for the `record` field 574 pub struct record(()); 575 } 576} 577 578/// Builder for constructing an instance of this type 579pub struct ViewBuilder<'a, S: view_state::State> { 580 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 581 __unsafe_private_named: (::core::option::Option<ViewUnionRecord<'a>>,), 582 _phantom: ::core::marker::PhantomData<&'a ()>, 583} 584 585impl<'a> View<'a> { 586 /// Create a new builder for this type 587 pub fn new() -> ViewBuilder<'a, view_state::Empty> { 588 ViewBuilder::new() 589 } 590} 591 592impl<'a> ViewBuilder<'a, view_state::Empty> { 593 /// Create a new builder with all fields unset 594 pub fn new() -> Self { 595 ViewBuilder { 596 _phantom_state: ::core::marker::PhantomData, 597 __unsafe_private_named: (None,), 598 _phantom: ::core::marker::PhantomData, 599 } 600 } 601} 602 603impl<'a, S> ViewBuilder<'a, S> 604where 605 S: view_state::State, 606 S::Record: view_state::IsUnset, 607{ 608 /// Set the `record` field (required) 609 pub fn record( 610 mut self, 611 value: impl Into<ViewUnionRecord<'a>>, 612 ) -> ViewBuilder<'a, view_state::SetRecord<S>> { 613 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 614 ViewBuilder { 615 _phantom_state: ::core::marker::PhantomData, 616 __unsafe_private_named: self.__unsafe_private_named, 617 _phantom: ::core::marker::PhantomData, 618 } 619 } 620} 621 622impl<'a, S> ViewBuilder<'a, S> 623where 624 S: view_state::State, 625 S::Record: view_state::IsSet, 626{ 627 /// Build the final struct 628 pub fn build(self) -> View<'a> { 629 View { 630 record: self.__unsafe_private_named.0.unwrap(), 631 extra_data: Default::default(), 632 } 633 } 634 /// Build the final struct with custom extra_data 635 pub fn build_with_data( 636 self, 637 extra_data: std::collections::BTreeMap< 638 jacquard_common::smol_str::SmolStr, 639 jacquard_common::types::value::Data<'a>, 640 >, 641 ) -> View<'a> { 642 View { 643 record: self.__unsafe_private_named.0.unwrap(), 644 extra_data: Some(extra_data), 645 } 646 } 647} 648 649#[jacquard_derive::open_union] 650#[derive( 651 serde::Serialize, 652 serde::Deserialize, 653 Debug, 654 Clone, 655 PartialEq, 656 Eq, 657 jacquard_derive::IntoStatic 658)] 659#[serde(tag = "$type")] 660#[serde(bound(deserialize = "'de: 'a"))] 661pub enum ViewUnionRecord<'a> { 662 #[serde(rename = "app.bsky.embed.record#viewRecord")] 663 ViewRecord(Box<crate::app_bsky::embed::record::ViewRecord<'a>>), 664 #[serde(rename = "app.bsky.embed.record#viewNotFound")] 665 ViewNotFound(Box<crate::app_bsky::embed::record::ViewNotFound<'a>>), 666 #[serde(rename = "app.bsky.embed.record#viewBlocked")] 667 ViewBlocked(Box<crate::app_bsky::embed::record::ViewBlocked<'a>>), 668 #[serde(rename = "app.bsky.embed.record#viewDetached")] 669 ViewDetached(Box<crate::app_bsky::embed::record::ViewDetached<'a>>), 670 #[serde(rename = "app.bsky.feed.defs#generatorView")] 671 GeneratorView(Box<crate::app_bsky::feed::GeneratorView<'a>>), 672 #[serde(rename = "app.bsky.graph.defs#listView")] 673 ListView(Box<crate::app_bsky::graph::ListView<'a>>), 674 #[serde(rename = "app.bsky.labeler.defs#labelerView")] 675 LabelerView(Box<crate::app_bsky::labeler::LabelerView<'a>>), 676 #[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")] 677 StarterPackViewBasic(Box<crate::app_bsky::graph::StarterPackViewBasic<'a>>), 678} 679 680impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { 681 fn nsid() -> &'static str { 682 "app.bsky.embed.record" 683 } 684 fn def_name() -> &'static str { 685 "view" 686 } 687 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 688 lexicon_doc_app_bsky_embed_record() 689 } 690 fn validate( 691 &self, 692 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 693 Ok(()) 694 } 695} 696 697#[jacquard_derive::lexicon] 698#[derive( 699 serde::Serialize, 700 serde::Deserialize, 701 Debug, 702 Clone, 703 PartialEq, 704 Eq, 705 jacquard_derive::IntoStatic 706)] 707#[serde(rename_all = "camelCase")] 708pub struct ViewBlocked<'a> { 709 #[serde(borrow)] 710 pub author: crate::app_bsky::feed::BlockedAuthor<'a>, 711 pub blocked: bool, 712 #[serde(borrow)] 713 pub uri: jacquard_common::types::string::AtUri<'a>, 714} 715 716pub mod view_blocked_state { 717 718 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 719 #[allow(unused)] 720 use ::core::marker::PhantomData; 721 mod sealed { 722 pub trait Sealed {} 723 } 724 /// State trait tracking which required fields have been set 725 pub trait State: sealed::Sealed { 726 type Blocked; 727 type Author; 728 type Uri; 729 } 730 /// Empty state - all required fields are unset 731 pub struct Empty(()); 732 impl sealed::Sealed for Empty {} 733 impl State for Empty { 734 type Blocked = Unset; 735 type Author = Unset; 736 type Uri = Unset; 737 } 738 ///State transition - sets the `blocked` field to Set 739 pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>); 740 impl<S: State> sealed::Sealed for SetBlocked<S> {} 741 impl<S: State> State for SetBlocked<S> { 742 type Blocked = Set<members::blocked>; 743 type Author = S::Author; 744 type Uri = S::Uri; 745 } 746 ///State transition - sets the `author` field to Set 747 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); 748 impl<S: State> sealed::Sealed for SetAuthor<S> {} 749 impl<S: State> State for SetAuthor<S> { 750 type Blocked = S::Blocked; 751 type Author = Set<members::author>; 752 type Uri = S::Uri; 753 } 754 ///State transition - sets the `uri` field to Set 755 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 756 impl<S: State> sealed::Sealed for SetUri<S> {} 757 impl<S: State> State for SetUri<S> { 758 type Blocked = S::Blocked; 759 type Author = S::Author; 760 type Uri = Set<members::uri>; 761 } 762 /// Marker types for field names 763 #[allow(non_camel_case_types)] 764 pub mod members { 765 ///Marker type for the `blocked` field 766 pub struct blocked(()); 767 ///Marker type for the `author` field 768 pub struct author(()); 769 ///Marker type for the `uri` field 770 pub struct uri(()); 771 } 772} 773 774/// Builder for constructing an instance of this type 775pub struct ViewBlockedBuilder<'a, S: view_blocked_state::State> { 776 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 777 __unsafe_private_named: ( 778 ::core::option::Option<crate::app_bsky::feed::BlockedAuthor<'a>>, 779 ::core::option::Option<bool>, 780 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 781 ), 782 _phantom: ::core::marker::PhantomData<&'a ()>, 783} 784 785impl<'a> ViewBlocked<'a> { 786 /// Create a new builder for this type 787 pub fn new() -> ViewBlockedBuilder<'a, view_blocked_state::Empty> { 788 ViewBlockedBuilder::new() 789 } 790} 791 792impl<'a> ViewBlockedBuilder<'a, view_blocked_state::Empty> { 793 /// Create a new builder with all fields unset 794 pub fn new() -> Self { 795 ViewBlockedBuilder { 796 _phantom_state: ::core::marker::PhantomData, 797 __unsafe_private_named: (None, None, None), 798 _phantom: ::core::marker::PhantomData, 799 } 800 } 801} 802 803impl<'a, S> ViewBlockedBuilder<'a, S> 804where 805 S: view_blocked_state::State, 806 S::Author: view_blocked_state::IsUnset, 807{ 808 /// Set the `author` field (required) 809 pub fn author( 810 mut self, 811 value: impl Into<crate::app_bsky::feed::BlockedAuthor<'a>>, 812 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetAuthor<S>> { 813 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 814 ViewBlockedBuilder { 815 _phantom_state: ::core::marker::PhantomData, 816 __unsafe_private_named: self.__unsafe_private_named, 817 _phantom: ::core::marker::PhantomData, 818 } 819 } 820} 821 822impl<'a, S> ViewBlockedBuilder<'a, S> 823where 824 S: view_blocked_state::State, 825 S::Blocked: view_blocked_state::IsUnset, 826{ 827 /// Set the `blocked` field (required) 828 pub fn blocked( 829 mut self, 830 value: impl Into<bool>, 831 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetBlocked<S>> { 832 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 833 ViewBlockedBuilder { 834 _phantom_state: ::core::marker::PhantomData, 835 __unsafe_private_named: self.__unsafe_private_named, 836 _phantom: ::core::marker::PhantomData, 837 } 838 } 839} 840 841impl<'a, S> ViewBlockedBuilder<'a, S> 842where 843 S: view_blocked_state::State, 844 S::Uri: view_blocked_state::IsUnset, 845{ 846 /// Set the `uri` field (required) 847 pub fn uri( 848 mut self, 849 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 850 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetUri<S>> { 851 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 852 ViewBlockedBuilder { 853 _phantom_state: ::core::marker::PhantomData, 854 __unsafe_private_named: self.__unsafe_private_named, 855 _phantom: ::core::marker::PhantomData, 856 } 857 } 858} 859 860impl<'a, S> ViewBlockedBuilder<'a, S> 861where 862 S: view_blocked_state::State, 863 S::Blocked: view_blocked_state::IsSet, 864 S::Author: view_blocked_state::IsSet, 865 S::Uri: view_blocked_state::IsSet, 866{ 867 /// Build the final struct 868 pub fn build(self) -> ViewBlocked<'a> { 869 ViewBlocked { 870 author: self.__unsafe_private_named.0.unwrap(), 871 blocked: self.__unsafe_private_named.1.unwrap(), 872 uri: self.__unsafe_private_named.2.unwrap(), 873 extra_data: Default::default(), 874 } 875 } 876 /// Build the final struct with custom extra_data 877 pub fn build_with_data( 878 self, 879 extra_data: std::collections::BTreeMap< 880 jacquard_common::smol_str::SmolStr, 881 jacquard_common::types::value::Data<'a>, 882 >, 883 ) -> ViewBlocked<'a> { 884 ViewBlocked { 885 author: self.__unsafe_private_named.0.unwrap(), 886 blocked: self.__unsafe_private_named.1.unwrap(), 887 uri: self.__unsafe_private_named.2.unwrap(), 888 extra_data: Some(extra_data), 889 } 890 } 891} 892 893impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewBlocked<'a> { 894 fn nsid() -> &'static str { 895 "app.bsky.embed.record" 896 } 897 fn def_name() -> &'static str { 898 "viewBlocked" 899 } 900 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 901 lexicon_doc_app_bsky_embed_record() 902 } 903 fn validate( 904 &self, 905 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 906 Ok(()) 907 } 908} 909 910#[jacquard_derive::lexicon] 911#[derive( 912 serde::Serialize, 913 serde::Deserialize, 914 Debug, 915 Clone, 916 PartialEq, 917 Eq, 918 jacquard_derive::IntoStatic 919)] 920#[serde(rename_all = "camelCase")] 921pub struct ViewDetached<'a> { 922 pub detached: bool, 923 #[serde(borrow)] 924 pub uri: jacquard_common::types::string::AtUri<'a>, 925} 926 927pub mod view_detached_state { 928 929 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 930 #[allow(unused)] 931 use ::core::marker::PhantomData; 932 mod sealed { 933 pub trait Sealed {} 934 } 935 /// State trait tracking which required fields have been set 936 pub trait State: sealed::Sealed { 937 type Detached; 938 type Uri; 939 } 940 /// Empty state - all required fields are unset 941 pub struct Empty(()); 942 impl sealed::Sealed for Empty {} 943 impl State for Empty { 944 type Detached = Unset; 945 type Uri = Unset; 946 } 947 ///State transition - sets the `detached` field to Set 948 pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>); 949 impl<S: State> sealed::Sealed for SetDetached<S> {} 950 impl<S: State> State for SetDetached<S> { 951 type Detached = Set<members::detached>; 952 type Uri = S::Uri; 953 } 954 ///State transition - sets the `uri` field to Set 955 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 956 impl<S: State> sealed::Sealed for SetUri<S> {} 957 impl<S: State> State for SetUri<S> { 958 type Detached = S::Detached; 959 type Uri = Set<members::uri>; 960 } 961 /// Marker types for field names 962 #[allow(non_camel_case_types)] 963 pub mod members { 964 ///Marker type for the `detached` field 965 pub struct detached(()); 966 ///Marker type for the `uri` field 967 pub struct uri(()); 968 } 969} 970 971/// Builder for constructing an instance of this type 972pub struct ViewDetachedBuilder<'a, S: view_detached_state::State> { 973 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 974 __unsafe_private_named: ( 975 ::core::option::Option<bool>, 976 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 977 ), 978 _phantom: ::core::marker::PhantomData<&'a ()>, 979} 980 981impl<'a> ViewDetached<'a> { 982 /// Create a new builder for this type 983 pub fn new() -> ViewDetachedBuilder<'a, view_detached_state::Empty> { 984 ViewDetachedBuilder::new() 985 } 986} 987 988impl<'a> ViewDetachedBuilder<'a, view_detached_state::Empty> { 989 /// Create a new builder with all fields unset 990 pub fn new() -> Self { 991 ViewDetachedBuilder { 992 _phantom_state: ::core::marker::PhantomData, 993 __unsafe_private_named: (None, None), 994 _phantom: ::core::marker::PhantomData, 995 } 996 } 997} 998 999impl<'a, S> ViewDetachedBuilder<'a, S> 1000where 1001 S: view_detached_state::State, 1002 S::Detached: view_detached_state::IsUnset, 1003{ 1004 /// Set the `detached` field (required) 1005 pub fn detached( 1006 mut self, 1007 value: impl Into<bool>, 1008 ) -> ViewDetachedBuilder<'a, view_detached_state::SetDetached<S>> { 1009 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1010 ViewDetachedBuilder { 1011 _phantom_state: ::core::marker::PhantomData, 1012 __unsafe_private_named: self.__unsafe_private_named, 1013 _phantom: ::core::marker::PhantomData, 1014 } 1015 } 1016} 1017 1018impl<'a, S> ViewDetachedBuilder<'a, S> 1019where 1020 S: view_detached_state::State, 1021 S::Uri: view_detached_state::IsUnset, 1022{ 1023 /// Set the `uri` field (required) 1024 pub fn uri( 1025 mut self, 1026 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1027 ) -> ViewDetachedBuilder<'a, view_detached_state::SetUri<S>> { 1028 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1029 ViewDetachedBuilder { 1030 _phantom_state: ::core::marker::PhantomData, 1031 __unsafe_private_named: self.__unsafe_private_named, 1032 _phantom: ::core::marker::PhantomData, 1033 } 1034 } 1035} 1036 1037impl<'a, S> ViewDetachedBuilder<'a, S> 1038where 1039 S: view_detached_state::State, 1040 S::Detached: view_detached_state::IsSet, 1041 S::Uri: view_detached_state::IsSet, 1042{ 1043 /// Build the final struct 1044 pub fn build(self) -> ViewDetached<'a> { 1045 ViewDetached { 1046 detached: self.__unsafe_private_named.0.unwrap(), 1047 uri: self.__unsafe_private_named.1.unwrap(), 1048 extra_data: Default::default(), 1049 } 1050 } 1051 /// Build the final struct with custom extra_data 1052 pub fn build_with_data( 1053 self, 1054 extra_data: std::collections::BTreeMap< 1055 jacquard_common::smol_str::SmolStr, 1056 jacquard_common::types::value::Data<'a>, 1057 >, 1058 ) -> ViewDetached<'a> { 1059 ViewDetached { 1060 detached: self.__unsafe_private_named.0.unwrap(), 1061 uri: self.__unsafe_private_named.1.unwrap(), 1062 extra_data: Some(extra_data), 1063 } 1064 } 1065} 1066 1067impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewDetached<'a> { 1068 fn nsid() -> &'static str { 1069 "app.bsky.embed.record" 1070 } 1071 fn def_name() -> &'static str { 1072 "viewDetached" 1073 } 1074 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1075 lexicon_doc_app_bsky_embed_record() 1076 } 1077 fn validate( 1078 &self, 1079 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1080 Ok(()) 1081 } 1082} 1083 1084#[jacquard_derive::lexicon] 1085#[derive( 1086 serde::Serialize, 1087 serde::Deserialize, 1088 Debug, 1089 Clone, 1090 PartialEq, 1091 Eq, 1092 jacquard_derive::IntoStatic 1093)] 1094#[serde(rename_all = "camelCase")] 1095pub struct ViewNotFound<'a> { 1096 pub not_found: bool, 1097 #[serde(borrow)] 1098 pub uri: jacquard_common::types::string::AtUri<'a>, 1099} 1100 1101pub mod view_not_found_state { 1102 1103 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1104 #[allow(unused)] 1105 use ::core::marker::PhantomData; 1106 mod sealed { 1107 pub trait Sealed {} 1108 } 1109 /// State trait tracking which required fields have been set 1110 pub trait State: sealed::Sealed { 1111 type NotFound; 1112 type Uri; 1113 } 1114 /// Empty state - all required fields are unset 1115 pub struct Empty(()); 1116 impl sealed::Sealed for Empty {} 1117 impl State for Empty { 1118 type NotFound = Unset; 1119 type Uri = Unset; 1120 } 1121 ///State transition - sets the `not_found` field to Set 1122 pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>); 1123 impl<S: State> sealed::Sealed for SetNotFound<S> {} 1124 impl<S: State> State for SetNotFound<S> { 1125 type NotFound = Set<members::not_found>; 1126 type Uri = S::Uri; 1127 } 1128 ///State transition - sets the `uri` field to Set 1129 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1130 impl<S: State> sealed::Sealed for SetUri<S> {} 1131 impl<S: State> State for SetUri<S> { 1132 type NotFound = S::NotFound; 1133 type Uri = Set<members::uri>; 1134 } 1135 /// Marker types for field names 1136 #[allow(non_camel_case_types)] 1137 pub mod members { 1138 ///Marker type for the `not_found` field 1139 pub struct not_found(()); 1140 ///Marker type for the `uri` field 1141 pub struct uri(()); 1142 } 1143} 1144 1145/// Builder for constructing an instance of this type 1146pub struct ViewNotFoundBuilder<'a, S: view_not_found_state::State> { 1147 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1148 __unsafe_private_named: ( 1149 ::core::option::Option<bool>, 1150 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1151 ), 1152 _phantom: ::core::marker::PhantomData<&'a ()>, 1153} 1154 1155impl<'a> ViewNotFound<'a> { 1156 /// Create a new builder for this type 1157 pub fn new() -> ViewNotFoundBuilder<'a, view_not_found_state::Empty> { 1158 ViewNotFoundBuilder::new() 1159 } 1160} 1161 1162impl<'a> ViewNotFoundBuilder<'a, view_not_found_state::Empty> { 1163 /// Create a new builder with all fields unset 1164 pub fn new() -> Self { 1165 ViewNotFoundBuilder { 1166 _phantom_state: ::core::marker::PhantomData, 1167 __unsafe_private_named: (None, None), 1168 _phantom: ::core::marker::PhantomData, 1169 } 1170 } 1171} 1172 1173impl<'a, S> ViewNotFoundBuilder<'a, S> 1174where 1175 S: view_not_found_state::State, 1176 S::NotFound: view_not_found_state::IsUnset, 1177{ 1178 /// Set the `notFound` field (required) 1179 pub fn not_found( 1180 mut self, 1181 value: impl Into<bool>, 1182 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetNotFound<S>> { 1183 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1184 ViewNotFoundBuilder { 1185 _phantom_state: ::core::marker::PhantomData, 1186 __unsafe_private_named: self.__unsafe_private_named, 1187 _phantom: ::core::marker::PhantomData, 1188 } 1189 } 1190} 1191 1192impl<'a, S> ViewNotFoundBuilder<'a, S> 1193where 1194 S: view_not_found_state::State, 1195 S::Uri: view_not_found_state::IsUnset, 1196{ 1197 /// Set the `uri` field (required) 1198 pub fn uri( 1199 mut self, 1200 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1201 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetUri<S>> { 1202 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1203 ViewNotFoundBuilder { 1204 _phantom_state: ::core::marker::PhantomData, 1205 __unsafe_private_named: self.__unsafe_private_named, 1206 _phantom: ::core::marker::PhantomData, 1207 } 1208 } 1209} 1210 1211impl<'a, S> ViewNotFoundBuilder<'a, S> 1212where 1213 S: view_not_found_state::State, 1214 S::NotFound: view_not_found_state::IsSet, 1215 S::Uri: view_not_found_state::IsSet, 1216{ 1217 /// Build the final struct 1218 pub fn build(self) -> ViewNotFound<'a> { 1219 ViewNotFound { 1220 not_found: self.__unsafe_private_named.0.unwrap(), 1221 uri: self.__unsafe_private_named.1.unwrap(), 1222 extra_data: Default::default(), 1223 } 1224 } 1225 /// Build the final struct with custom extra_data 1226 pub fn build_with_data( 1227 self, 1228 extra_data: std::collections::BTreeMap< 1229 jacquard_common::smol_str::SmolStr, 1230 jacquard_common::types::value::Data<'a>, 1231 >, 1232 ) -> ViewNotFound<'a> { 1233 ViewNotFound { 1234 not_found: self.__unsafe_private_named.0.unwrap(), 1235 uri: self.__unsafe_private_named.1.unwrap(), 1236 extra_data: Some(extra_data), 1237 } 1238 } 1239} 1240 1241impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewNotFound<'a> { 1242 fn nsid() -> &'static str { 1243 "app.bsky.embed.record" 1244 } 1245 fn def_name() -> &'static str { 1246 "viewNotFound" 1247 } 1248 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1249 lexicon_doc_app_bsky_embed_record() 1250 } 1251 fn validate( 1252 &self, 1253 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1254 Ok(()) 1255 } 1256} 1257 1258#[jacquard_derive::lexicon] 1259#[derive( 1260 serde::Serialize, 1261 serde::Deserialize, 1262 Debug, 1263 Clone, 1264 PartialEq, 1265 Eq, 1266 jacquard_derive::IntoStatic 1267)] 1268#[serde(rename_all = "camelCase")] 1269pub struct ViewRecord<'a> { 1270 #[serde(borrow)] 1271 pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, 1272 #[serde(borrow)] 1273 pub cid: jacquard_common::types::string::Cid<'a>, 1274 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1275 #[serde(borrow)] 1276 pub embeds: std::option::Option<Vec<ViewRecordEmbedsItem<'a>>>, 1277 pub indexed_at: jacquard_common::types::string::Datetime, 1278 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1279 #[serde(borrow)] 1280 pub labels: std::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 1281 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1282 pub like_count: std::option::Option<i64>, 1283 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1284 pub quote_count: std::option::Option<i64>, 1285 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1286 pub reply_count: std::option::Option<i64>, 1287 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1288 pub repost_count: std::option::Option<i64>, 1289 #[serde(borrow)] 1290 pub uri: jacquard_common::types::string::AtUri<'a>, 1291 /// The record data itself. 1292 #[serde(borrow)] 1293 pub value: jacquard_common::types::value::Data<'a>, 1294} 1295 1296pub mod view_record_state { 1297 1298 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1299 #[allow(unused)] 1300 use ::core::marker::PhantomData; 1301 mod sealed { 1302 pub trait Sealed {} 1303 } 1304 /// State trait tracking which required fields have been set 1305 pub trait State: sealed::Sealed { 1306 type Value; 1307 type IndexedAt; 1308 type Author; 1309 type Uri; 1310 type Cid; 1311 } 1312 /// Empty state - all required fields are unset 1313 pub struct Empty(()); 1314 impl sealed::Sealed for Empty {} 1315 impl State for Empty { 1316 type Value = Unset; 1317 type IndexedAt = Unset; 1318 type Author = Unset; 1319 type Uri = Unset; 1320 type Cid = Unset; 1321 } 1322 ///State transition - sets the `value` field to Set 1323 pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); 1324 impl<S: State> sealed::Sealed for SetValue<S> {} 1325 impl<S: State> State for SetValue<S> { 1326 type Value = Set<members::value>; 1327 type IndexedAt = S::IndexedAt; 1328 type Author = S::Author; 1329 type Uri = S::Uri; 1330 type Cid = S::Cid; 1331 } 1332 ///State transition - sets the `indexed_at` field to Set 1333 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); 1334 impl<S: State> sealed::Sealed for SetIndexedAt<S> {} 1335 impl<S: State> State for SetIndexedAt<S> { 1336 type Value = S::Value; 1337 type IndexedAt = Set<members::indexed_at>; 1338 type Author = S::Author; 1339 type Uri = S::Uri; 1340 type Cid = S::Cid; 1341 } 1342 ///State transition - sets the `author` field to Set 1343 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); 1344 impl<S: State> sealed::Sealed for SetAuthor<S> {} 1345 impl<S: State> State for SetAuthor<S> { 1346 type Value = S::Value; 1347 type IndexedAt = S::IndexedAt; 1348 type Author = Set<members::author>; 1349 type Uri = S::Uri; 1350 type Cid = S::Cid; 1351 } 1352 ///State transition - sets the `uri` field to Set 1353 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1354 impl<S: State> sealed::Sealed for SetUri<S> {} 1355 impl<S: State> State for SetUri<S> { 1356 type Value = S::Value; 1357 type IndexedAt = S::IndexedAt; 1358 type Author = S::Author; 1359 type Uri = Set<members::uri>; 1360 type Cid = S::Cid; 1361 } 1362 ///State transition - sets the `cid` field to Set 1363 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 1364 impl<S: State> sealed::Sealed for SetCid<S> {} 1365 impl<S: State> State for SetCid<S> { 1366 type Value = S::Value; 1367 type IndexedAt = S::IndexedAt; 1368 type Author = S::Author; 1369 type Uri = S::Uri; 1370 type Cid = Set<members::cid>; 1371 } 1372 /// Marker types for field names 1373 #[allow(non_camel_case_types)] 1374 pub mod members { 1375 ///Marker type for the `value` field 1376 pub struct value(()); 1377 ///Marker type for the `indexed_at` field 1378 pub struct indexed_at(()); 1379 ///Marker type for the `author` field 1380 pub struct author(()); 1381 ///Marker type for the `uri` field 1382 pub struct uri(()); 1383 ///Marker type for the `cid` field 1384 pub struct cid(()); 1385 } 1386} 1387 1388/// Builder for constructing an instance of this type 1389pub struct ViewRecordBuilder<'a, S: view_record_state::State> { 1390 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1391 __unsafe_private_named: ( 1392 ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, 1393 ::core::option::Option<jacquard_common::types::string::Cid<'a>>, 1394 ::core::option::Option<Vec<ViewRecordEmbedsItem<'a>>>, 1395 ::core::option::Option<jacquard_common::types::string::Datetime>, 1396 ::core::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 1397 ::core::option::Option<i64>, 1398 ::core::option::Option<i64>, 1399 ::core::option::Option<i64>, 1400 ::core::option::Option<i64>, 1401 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1402 ::core::option::Option<jacquard_common::types::value::Data<'a>>, 1403 ), 1404 _phantom: ::core::marker::PhantomData<&'a ()>, 1405} 1406 1407impl<'a> ViewRecord<'a> { 1408 /// Create a new builder for this type 1409 pub fn new() -> ViewRecordBuilder<'a, view_record_state::Empty> { 1410 ViewRecordBuilder::new() 1411 } 1412} 1413 1414impl<'a> ViewRecordBuilder<'a, view_record_state::Empty> { 1415 /// Create a new builder with all fields unset 1416 pub fn new() -> Self { 1417 ViewRecordBuilder { 1418 _phantom_state: ::core::marker::PhantomData, 1419 __unsafe_private_named: ( 1420 None, 1421 None, 1422 None, 1423 None, 1424 None, 1425 None, 1426 None, 1427 None, 1428 None, 1429 None, 1430 None, 1431 ), 1432 _phantom: ::core::marker::PhantomData, 1433 } 1434 } 1435} 1436 1437impl<'a, S> ViewRecordBuilder<'a, S> 1438where 1439 S: view_record_state::State, 1440 S::Author: view_record_state::IsUnset, 1441{ 1442 /// Set the `author` field (required) 1443 pub fn author( 1444 mut self, 1445 value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, 1446 ) -> ViewRecordBuilder<'a, view_record_state::SetAuthor<S>> { 1447 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1448 ViewRecordBuilder { 1449 _phantom_state: ::core::marker::PhantomData, 1450 __unsafe_private_named: self.__unsafe_private_named, 1451 _phantom: ::core::marker::PhantomData, 1452 } 1453 } 1454} 1455 1456impl<'a, S> ViewRecordBuilder<'a, S> 1457where 1458 S: view_record_state::State, 1459 S::Cid: view_record_state::IsUnset, 1460{ 1461 /// Set the `cid` field (required) 1462 pub fn cid( 1463 mut self, 1464 value: impl Into<jacquard_common::types::string::Cid<'a>>, 1465 ) -> ViewRecordBuilder<'a, view_record_state::SetCid<S>> { 1466 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1467 ViewRecordBuilder { 1468 _phantom_state: ::core::marker::PhantomData, 1469 __unsafe_private_named: self.__unsafe_private_named, 1470 _phantom: ::core::marker::PhantomData, 1471 } 1472 } 1473} 1474 1475impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1476 /// Set the `embeds` field (optional) 1477 pub fn embeds( 1478 mut self, 1479 value: impl Into<Option<Vec<ViewRecordEmbedsItem<'a>>>>, 1480 ) -> Self { 1481 self.__unsafe_private_named.2 = value.into(); 1482 self 1483 } 1484 /// Set the `embeds` field to an Option value (optional) 1485 pub fn maybe_embeds(mut self, value: Option<Vec<ViewRecordEmbedsItem<'a>>>) -> Self { 1486 self.__unsafe_private_named.2 = value; 1487 self 1488 } 1489} 1490 1491impl<'a, S> ViewRecordBuilder<'a, S> 1492where 1493 S: view_record_state::State, 1494 S::IndexedAt: view_record_state::IsUnset, 1495{ 1496 /// Set the `indexedAt` field (required) 1497 pub fn indexed_at( 1498 mut self, 1499 value: impl Into<jacquard_common::types::string::Datetime>, 1500 ) -> ViewRecordBuilder<'a, view_record_state::SetIndexedAt<S>> { 1501 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); 1502 ViewRecordBuilder { 1503 _phantom_state: ::core::marker::PhantomData, 1504 __unsafe_private_named: self.__unsafe_private_named, 1505 _phantom: ::core::marker::PhantomData, 1506 } 1507 } 1508} 1509 1510impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1511 /// Set the `labels` field (optional) 1512 pub fn labels( 1513 mut self, 1514 value: impl Into<Option<Vec<crate::com_atproto::label::Label<'a>>>>, 1515 ) -> Self { 1516 self.__unsafe_private_named.4 = value.into(); 1517 self 1518 } 1519 /// Set the `labels` field to an Option value (optional) 1520 pub fn maybe_labels( 1521 mut self, 1522 value: Option<Vec<crate::com_atproto::label::Label<'a>>>, 1523 ) -> Self { 1524 self.__unsafe_private_named.4 = value; 1525 self 1526 } 1527} 1528 1529impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1530 /// Set the `likeCount` field (optional) 1531 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self { 1532 self.__unsafe_private_named.5 = value.into(); 1533 self 1534 } 1535 /// Set the `likeCount` field to an Option value (optional) 1536 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self { 1537 self.__unsafe_private_named.5 = value; 1538 self 1539 } 1540} 1541 1542impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1543 /// Set the `quoteCount` field (optional) 1544 pub fn quote_count(mut self, value: impl Into<Option<i64>>) -> Self { 1545 self.__unsafe_private_named.6 = value.into(); 1546 self 1547 } 1548 /// Set the `quoteCount` field to an Option value (optional) 1549 pub fn maybe_quote_count(mut self, value: Option<i64>) -> Self { 1550 self.__unsafe_private_named.6 = value; 1551 self 1552 } 1553} 1554 1555impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1556 /// Set the `replyCount` field (optional) 1557 pub fn reply_count(mut self, value: impl Into<Option<i64>>) -> Self { 1558 self.__unsafe_private_named.7 = value.into(); 1559 self 1560 } 1561 /// Set the `replyCount` field to an Option value (optional) 1562 pub fn maybe_reply_count(mut self, value: Option<i64>) -> Self { 1563 self.__unsafe_private_named.7 = value; 1564 self 1565 } 1566} 1567 1568impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> { 1569 /// Set the `repostCount` field (optional) 1570 pub fn repost_count(mut self, value: impl Into<Option<i64>>) -> Self { 1571 self.__unsafe_private_named.8 = value.into(); 1572 self 1573 } 1574 /// Set the `repostCount` field to an Option value (optional) 1575 pub fn maybe_repost_count(mut self, value: Option<i64>) -> Self { 1576 self.__unsafe_private_named.8 = value; 1577 self 1578 } 1579} 1580 1581impl<'a, S> ViewRecordBuilder<'a, S> 1582where 1583 S: view_record_state::State, 1584 S::Uri: view_record_state::IsUnset, 1585{ 1586 /// Set the `uri` field (required) 1587 pub fn uri( 1588 mut self, 1589 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1590 ) -> ViewRecordBuilder<'a, view_record_state::SetUri<S>> { 1591 self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); 1592 ViewRecordBuilder { 1593 _phantom_state: ::core::marker::PhantomData, 1594 __unsafe_private_named: self.__unsafe_private_named, 1595 _phantom: ::core::marker::PhantomData, 1596 } 1597 } 1598} 1599 1600impl<'a, S> ViewRecordBuilder<'a, S> 1601where 1602 S: view_record_state::State, 1603 S::Value: view_record_state::IsUnset, 1604{ 1605 /// Set the `value` field (required) 1606 pub fn value( 1607 mut self, 1608 value: impl Into<jacquard_common::types::value::Data<'a>>, 1609 ) -> ViewRecordBuilder<'a, view_record_state::SetValue<S>> { 1610 self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into()); 1611 ViewRecordBuilder { 1612 _phantom_state: ::core::marker::PhantomData, 1613 __unsafe_private_named: self.__unsafe_private_named, 1614 _phantom: ::core::marker::PhantomData, 1615 } 1616 } 1617} 1618 1619impl<'a, S> ViewRecordBuilder<'a, S> 1620where 1621 S: view_record_state::State, 1622 S::Value: view_record_state::IsSet, 1623 S::IndexedAt: view_record_state::IsSet, 1624 S::Author: view_record_state::IsSet, 1625 S::Uri: view_record_state::IsSet, 1626 S::Cid: view_record_state::IsSet, 1627{ 1628 /// Build the final struct 1629 pub fn build(self) -> ViewRecord<'a> { 1630 ViewRecord { 1631 author: self.__unsafe_private_named.0.unwrap(), 1632 cid: self.__unsafe_private_named.1.unwrap(), 1633 embeds: self.__unsafe_private_named.2, 1634 indexed_at: self.__unsafe_private_named.3.unwrap(), 1635 labels: self.__unsafe_private_named.4, 1636 like_count: self.__unsafe_private_named.5, 1637 quote_count: self.__unsafe_private_named.6, 1638 reply_count: self.__unsafe_private_named.7, 1639 repost_count: self.__unsafe_private_named.8, 1640 uri: self.__unsafe_private_named.9.unwrap(), 1641 value: self.__unsafe_private_named.10.unwrap(), 1642 extra_data: Default::default(), 1643 } 1644 } 1645 /// Build the final struct with custom extra_data 1646 pub fn build_with_data( 1647 self, 1648 extra_data: std::collections::BTreeMap< 1649 jacquard_common::smol_str::SmolStr, 1650 jacquard_common::types::value::Data<'a>, 1651 >, 1652 ) -> ViewRecord<'a> { 1653 ViewRecord { 1654 author: self.__unsafe_private_named.0.unwrap(), 1655 cid: self.__unsafe_private_named.1.unwrap(), 1656 embeds: self.__unsafe_private_named.2, 1657 indexed_at: self.__unsafe_private_named.3.unwrap(), 1658 labels: self.__unsafe_private_named.4, 1659 like_count: self.__unsafe_private_named.5, 1660 quote_count: self.__unsafe_private_named.6, 1661 reply_count: self.__unsafe_private_named.7, 1662 repost_count: self.__unsafe_private_named.8, 1663 uri: self.__unsafe_private_named.9.unwrap(), 1664 value: self.__unsafe_private_named.10.unwrap(), 1665 extra_data: Some(extra_data), 1666 } 1667 } 1668} 1669 1670#[jacquard_derive::open_union] 1671#[derive( 1672 serde::Serialize, 1673 serde::Deserialize, 1674 Debug, 1675 Clone, 1676 PartialEq, 1677 Eq, 1678 jacquard_derive::IntoStatic 1679)] 1680#[serde(tag = "$type")] 1681#[serde(bound(deserialize = "'de: 'a"))] 1682pub enum ViewRecordEmbedsItem<'a> { 1683 #[serde(rename = "app.bsky.embed.images#view")] 1684 ImagesView(Box<crate::app_bsky::embed::images::View<'a>>), 1685 #[serde(rename = "app.bsky.embed.video#view")] 1686 VideoView(Box<crate::app_bsky::embed::video::View<'a>>), 1687 #[serde(rename = "app.bsky.embed.external#view")] 1688 ExternalView(Box<crate::app_bsky::embed::external::View<'a>>), 1689 #[serde(rename = "app.bsky.embed.record#view")] 1690 View(Box<crate::app_bsky::embed::record::View<'a>>), 1691 #[serde(rename = "app.bsky.embed.recordWithMedia#view")] 1692 RecordWithMediaView(Box<crate::app_bsky::embed::record_with_media::View<'a>>), 1693} 1694 1695impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewRecord<'a> { 1696 fn nsid() -> &'static str { 1697 "app.bsky.embed.record" 1698 } 1699 fn def_name() -> &'static str { 1700 "viewRecord" 1701 } 1702 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1703 lexicon_doc_app_bsky_embed_record() 1704 } 1705 fn validate( 1706 &self, 1707 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1708 Ok(()) 1709 } 1710}