atproto blogging
at main 2426 lines 92 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.weaver.graph.defs 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8pub mod bookmark; 9pub mod follow; 10pub mod follow_accept; 11pub mod follow_gate; 12pub mod get_actor_bookmarks; 13pub mod get_actor_likes; 14pub mod get_actor_lists; 15pub mod get_actor_subscriptions; 16pub mod get_bookmarked_by; 17pub mod get_followers; 18pub mod get_following; 19pub mod get_liked_by; 20pub mod get_list; 21pub mod get_popular_tags; 22pub mod get_resource_tags; 23pub mod get_subscribers; 24pub mod get_tag_suggestions; 25pub mod get_tagged_resources; 26pub mod get_trending_tags; 27pub mod like; 28pub mod list; 29pub mod listitem; 30pub mod subscribe; 31pub mod subscribe_accept; 32pub mod tag; 33 34/// A community tag with how many people applied it. 35#[jacquard_derive::lexicon] 36#[derive( 37 serde::Serialize, 38 serde::Deserialize, 39 Debug, 40 Clone, 41 PartialEq, 42 Eq, 43 jacquard_derive::IntoStatic 44)] 45#[serde(rename_all = "camelCase")] 46pub struct CommunityTagCount<'a> { 47 pub count: i64, 48 #[serde(borrow)] 49 pub tag: jacquard_common::CowStr<'a>, 50} 51 52pub mod community_tag_count_state { 53 54 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 55 #[allow(unused)] 56 use ::core::marker::PhantomData; 57 mod sealed { 58 pub trait Sealed {} 59 } 60 /// State trait tracking which required fields have been set 61 pub trait State: sealed::Sealed { 62 type Count; 63 type Tag; 64 } 65 /// Empty state - all required fields are unset 66 pub struct Empty(()); 67 impl sealed::Sealed for Empty {} 68 impl State for Empty { 69 type Count = Unset; 70 type Tag = Unset; 71 } 72 ///State transition - sets the `count` field to Set 73 pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); 74 impl<S: State> sealed::Sealed for SetCount<S> {} 75 impl<S: State> State for SetCount<S> { 76 type Count = Set<members::count>; 77 type Tag = S::Tag; 78 } 79 ///State transition - sets the `tag` field to Set 80 pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); 81 impl<S: State> sealed::Sealed for SetTag<S> {} 82 impl<S: State> State for SetTag<S> { 83 type Count = S::Count; 84 type Tag = Set<members::tag>; 85 } 86 /// Marker types for field names 87 #[allow(non_camel_case_types)] 88 pub mod members { 89 ///Marker type for the `count` field 90 pub struct count(()); 91 ///Marker type for the `tag` field 92 pub struct tag(()); 93 } 94} 95 96/// Builder for constructing an instance of this type 97pub struct CommunityTagCountBuilder<'a, S: community_tag_count_state::State> { 98 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 99 __unsafe_private_named: ( 100 ::core::option::Option<i64>, 101 ::core::option::Option<jacquard_common::CowStr<'a>>, 102 ), 103 _phantom: ::core::marker::PhantomData<&'a ()>, 104} 105 106impl<'a> CommunityTagCount<'a> { 107 /// Create a new builder for this type 108 pub fn new() -> CommunityTagCountBuilder<'a, community_tag_count_state::Empty> { 109 CommunityTagCountBuilder::new() 110 } 111} 112 113impl<'a> CommunityTagCountBuilder<'a, community_tag_count_state::Empty> { 114 /// Create a new builder with all fields unset 115 pub fn new() -> Self { 116 CommunityTagCountBuilder { 117 _phantom_state: ::core::marker::PhantomData, 118 __unsafe_private_named: (None, None), 119 _phantom: ::core::marker::PhantomData, 120 } 121 } 122} 123 124impl<'a, S> CommunityTagCountBuilder<'a, S> 125where 126 S: community_tag_count_state::State, 127 S::Count: community_tag_count_state::IsUnset, 128{ 129 /// Set the `count` field (required) 130 pub fn count( 131 mut self, 132 value: impl Into<i64>, 133 ) -> CommunityTagCountBuilder<'a, community_tag_count_state::SetCount<S>> { 134 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 135 CommunityTagCountBuilder { 136 _phantom_state: ::core::marker::PhantomData, 137 __unsafe_private_named: self.__unsafe_private_named, 138 _phantom: ::core::marker::PhantomData, 139 } 140 } 141} 142 143impl<'a, S> CommunityTagCountBuilder<'a, S> 144where 145 S: community_tag_count_state::State, 146 S::Tag: community_tag_count_state::IsUnset, 147{ 148 /// Set the `tag` field (required) 149 pub fn tag( 150 mut self, 151 value: impl Into<jacquard_common::CowStr<'a>>, 152 ) -> CommunityTagCountBuilder<'a, community_tag_count_state::SetTag<S>> { 153 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 154 CommunityTagCountBuilder { 155 _phantom_state: ::core::marker::PhantomData, 156 __unsafe_private_named: self.__unsafe_private_named, 157 _phantom: ::core::marker::PhantomData, 158 } 159 } 160} 161 162impl<'a, S> CommunityTagCountBuilder<'a, S> 163where 164 S: community_tag_count_state::State, 165 S::Count: community_tag_count_state::IsSet, 166 S::Tag: community_tag_count_state::IsSet, 167{ 168 /// Build the final struct 169 pub fn build(self) -> CommunityTagCount<'a> { 170 CommunityTagCount { 171 count: self.__unsafe_private_named.0.unwrap(), 172 tag: self.__unsafe_private_named.1.unwrap(), 173 extra_data: Default::default(), 174 } 175 } 176 /// Build the final struct with custom extra_data 177 pub fn build_with_data( 178 self, 179 extra_data: std::collections::BTreeMap< 180 jacquard_common::smol_str::SmolStr, 181 jacquard_common::types::value::Data<'a>, 182 >, 183 ) -> CommunityTagCount<'a> { 184 CommunityTagCount { 185 count: self.__unsafe_private_named.0.unwrap(), 186 tag: self.__unsafe_private_named.1.unwrap(), 187 extra_data: Some(extra_data), 188 } 189 } 190} 191 192fn lexicon_doc_sh_weaver_graph_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 193 'static, 194> { 195 ::jacquard_lexicon::lexicon::LexiconDoc { 196 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 197 id: ::jacquard_common::CowStr::new_static("sh.weaver.graph.defs"), 198 revision: None, 199 description: None, 200 defs: { 201 let mut map = ::alloc::collections::BTreeMap::new(); 202 map.insert( 203 ::jacquard_common::smol_str::SmolStr::new_static("communityTagCount"), 204 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 205 description: Some( 206 ::jacquard_common::CowStr::new_static( 207 "A community tag with how many people applied it.", 208 ), 209 ), 210 required: Some( 211 vec![ 212 ::jacquard_common::smol_str::SmolStr::new_static("tag"), 213 ::jacquard_common::smol_str::SmolStr::new_static("count") 214 ], 215 ), 216 nullable: None, 217 properties: { 218 #[allow(unused_mut)] 219 let mut map = ::alloc::collections::BTreeMap::new(); 220 map.insert( 221 ::jacquard_common::smol_str::SmolStr::new_static("count"), 222 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 223 description: None, 224 default: None, 225 minimum: None, 226 maximum: None, 227 r#enum: None, 228 r#const: None, 229 }), 230 ); 231 map.insert( 232 ::jacquard_common::smol_str::SmolStr::new_static("tag"), 233 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 234 description: None, 235 format: None, 236 default: None, 237 min_length: None, 238 max_length: None, 239 min_graphemes: None, 240 max_graphemes: None, 241 r#enum: None, 242 r#const: None, 243 known_values: None, 244 }), 245 ); 246 map 247 }, 248 }), 249 ); 250 map.insert( 251 ::jacquard_common::smol_str::SmolStr::new_static("curatelist"), 252 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { 253 description: None, 254 }), 255 ); 256 map.insert( 257 ::jacquard_common::smol_str::SmolStr::new_static("listItemView"), 258 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 259 description: Some( 260 ::jacquard_common::CowStr::new_static( 261 "An item in a list with hydrated subject.", 262 ), 263 ), 264 required: Some( 265 vec![ 266 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 267 ::jacquard_common::smol_str::SmolStr::new_static("subject") 268 ], 269 ), 270 nullable: None, 271 properties: { 272 #[allow(unused_mut)] 273 let mut map = ::alloc::collections::BTreeMap::new(); 274 map.insert( 275 ::jacquard_common::smol_str::SmolStr::new_static("addedAt"), 276 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 277 description: None, 278 format: Some( 279 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 280 ), 281 default: None, 282 min_length: None, 283 max_length: None, 284 min_graphemes: None, 285 max_graphemes: None, 286 r#enum: None, 287 r#const: None, 288 known_values: None, 289 }), 290 ); 291 map.insert( 292 ::jacquard_common::smol_str::SmolStr::new_static("subject"), 293 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 294 description: None, 295 refs: vec![ 296 ::jacquard_common::CowStr::new_static("sh.weaver.notebook.defs#notebookView"), 297 ::jacquard_common::CowStr::new_static("sh.weaver.notebook.defs#entryView") 298 ], 299 closed: None, 300 }), 301 ); 302 map.insert( 303 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 304 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 305 description: None, 306 format: Some( 307 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 308 ), 309 default: None, 310 min_length: None, 311 max_length: None, 312 min_graphemes: None, 313 max_graphemes: None, 314 r#enum: None, 315 r#const: None, 316 known_values: None, 317 }), 318 ); 319 map 320 }, 321 }), 322 ); 323 map.insert( 324 ::jacquard_common::smol_str::SmolStr::new_static("listPurpose"), 325 ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { 326 description: None, 327 format: None, 328 default: None, 329 min_length: None, 330 max_length: None, 331 min_graphemes: None, 332 max_graphemes: None, 333 r#enum: None, 334 r#const: None, 335 known_values: None, 336 }), 337 ); 338 map.insert( 339 ::jacquard_common::smol_str::SmolStr::new_static("listView"), 340 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 341 description: Some( 342 ::jacquard_common::CowStr::new_static("Hydrated view of a list."), 343 ), 344 required: Some( 345 vec![ 346 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 347 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 348 ::jacquard_common::smol_str::SmolStr::new_static("creator"), 349 ::jacquard_common::smol_str::SmolStr::new_static("name"), 350 ::jacquard_common::smol_str::SmolStr::new_static("purpose"), 351 ::jacquard_common::smol_str::SmolStr::new_static("itemCount"), 352 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") 353 ], 354 ), 355 nullable: None, 356 properties: { 357 #[allow(unused_mut)] 358 let mut map = ::alloc::collections::BTreeMap::new(); 359 map.insert( 360 ::jacquard_common::smol_str::SmolStr::new_static("avatar"), 361 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 362 description: None, 363 format: Some( 364 ::jacquard_lexicon::lexicon::LexStringFormat::Uri, 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.insert( 377 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 378 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 379 description: None, 380 format: Some( 381 ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 382 ), 383 default: None, 384 min_length: None, 385 max_length: None, 386 min_graphemes: None, 387 max_graphemes: None, 388 r#enum: None, 389 r#const: None, 390 known_values: None, 391 }), 392 ); 393 map.insert( 394 ::jacquard_common::smol_str::SmolStr::new_static("creator"), 395 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 396 description: None, 397 r#ref: ::jacquard_common::CowStr::new_static( 398 "sh.weaver.actor.defs#profileViewBasic", 399 ), 400 }), 401 ); 402 map.insert( 403 ::jacquard_common::smol_str::SmolStr::new_static( 404 "description", 405 ), 406 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 407 description: None, 408 format: None, 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.insert( 420 ::jacquard_common::smol_str::SmolStr::new_static( 421 "indexedAt", 422 ), 423 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 424 description: None, 425 format: Some( 426 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 427 ), 428 default: None, 429 min_length: None, 430 max_length: None, 431 min_graphemes: None, 432 max_graphemes: None, 433 r#enum: None, 434 r#const: None, 435 known_values: None, 436 }), 437 ); 438 map.insert( 439 ::jacquard_common::smol_str::SmolStr::new_static( 440 "itemCount", 441 ), 442 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 443 description: None, 444 default: None, 445 minimum: None, 446 maximum: None, 447 r#enum: None, 448 r#const: None, 449 }), 450 ); 451 map.insert( 452 ::jacquard_common::smol_str::SmolStr::new_static("name"), 453 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 454 description: None, 455 format: None, 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("purpose"), 468 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 469 description: None, 470 r#ref: ::jacquard_common::CowStr::new_static("#listPurpose"), 471 }), 472 ); 473 map.insert( 474 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 475 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 476 description: None, 477 format: Some( 478 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 479 ), 480 default: None, 481 min_length: None, 482 max_length: None, 483 min_graphemes: None, 484 max_graphemes: None, 485 r#enum: None, 486 r#const: None, 487 known_values: None, 488 }), 489 ); 490 map.insert( 491 ::jacquard_common::smol_str::SmolStr::new_static( 492 "viewerSubscribed", 493 ), 494 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 495 description: None, 496 format: Some( 497 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 498 ), 499 default: None, 500 min_length: None, 501 max_length: None, 502 min_graphemes: None, 503 max_graphemes: None, 504 r#enum: None, 505 r#const: None, 506 known_values: None, 507 }), 508 ); 509 map 510 }, 511 }), 512 ); 513 map.insert( 514 ::jacquard_common::smol_str::SmolStr::new_static("readinglist"), 515 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { 516 description: None, 517 }), 518 ); 519 map.insert( 520 ::jacquard_common::smol_str::SmolStr::new_static("resourceTagsView"), 521 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 522 description: Some( 523 ::jacquard_common::CowStr::new_static( 524 "All tags for a resource, grouped by source.", 525 ), 526 ), 527 required: Some( 528 vec![ 529 ::jacquard_common::smol_str::SmolStr::new_static("resource"), 530 ::jacquard_common::smol_str::SmolStr::new_static("authorTags"), 531 ::jacquard_common::smol_str::SmolStr::new_static("communityTags") 532 ], 533 ), 534 nullable: None, 535 properties: { 536 #[allow(unused_mut)] 537 let mut map = ::alloc::collections::BTreeMap::new(); 538 map.insert( 539 ::jacquard_common::smol_str::SmolStr::new_static( 540 "authorTags", 541 ), 542 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 543 description: Some( 544 ::jacquard_common::CowStr::new_static( 545 "Tags from the record itself (author-applied).", 546 ), 547 ), 548 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { 549 description: None, 550 format: None, 551 default: None, 552 min_length: None, 553 max_length: None, 554 min_graphemes: None, 555 max_graphemes: None, 556 r#enum: None, 557 r#const: None, 558 known_values: None, 559 }), 560 min_length: None, 561 max_length: None, 562 }), 563 ); 564 map.insert( 565 ::jacquard_common::smol_str::SmolStr::new_static( 566 "communityTags", 567 ), 568 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 569 description: Some( 570 ::jacquard_common::CowStr::new_static( 571 "Aggregated community-applied tags with counts.", 572 ), 573 ), 574 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 575 description: None, 576 r#ref: ::jacquard_common::CowStr::new_static( 577 "#communityTagCount", 578 ), 579 }), 580 min_length: None, 581 max_length: None, 582 }), 583 ); 584 map.insert( 585 ::jacquard_common::smol_str::SmolStr::new_static("resource"), 586 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 587 description: None, 588 r#ref: ::jacquard_common::CowStr::new_static( 589 "com.atproto.repo.strongRef", 590 ), 591 }), 592 ); 593 map.insert( 594 ::jacquard_common::smol_str::SmolStr::new_static( 595 "viewerAppliedTags", 596 ), 597 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 598 description: Some( 599 ::jacquard_common::CowStr::new_static( 600 "Tags the current viewer has applied.", 601 ), 602 ), 603 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { 604 description: None, 605 format: None, 606 default: None, 607 min_length: None, 608 max_length: None, 609 min_graphemes: None, 610 max_graphemes: None, 611 r#enum: None, 612 r#const: None, 613 known_values: None, 614 }), 615 min_length: None, 616 max_length: None, 617 }), 618 ); 619 map 620 }, 621 }), 622 ); 623 map.insert( 624 ::jacquard_common::smol_str::SmolStr::new_static("serieslist"), 625 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { 626 description: None, 627 }), 628 ); 629 map.insert( 630 ::jacquard_common::smol_str::SmolStr::new_static("tagApplicationView"), 631 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 632 description: Some( 633 ::jacquard_common::CowStr::new_static( 634 "A single tag application with who applied it.", 635 ), 636 ), 637 required: Some( 638 vec![ 639 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 640 ::jacquard_common::smol_str::SmolStr::new_static("tag"), 641 ::jacquard_common::smol_str::SmolStr::new_static("appliedBy"), 642 ::jacquard_common::smol_str::SmolStr::new_static("createdAt") 643 ], 644 ), 645 nullable: None, 646 properties: { 647 #[allow(unused_mut)] 648 let mut map = ::alloc::collections::BTreeMap::new(); 649 map.insert( 650 ::jacquard_common::smol_str::SmolStr::new_static( 651 "appliedBy", 652 ), 653 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 654 description: None, 655 r#ref: ::jacquard_common::CowStr::new_static( 656 "sh.weaver.actor.defs#profileViewBasic", 657 ), 658 }), 659 ); 660 map.insert( 661 ::jacquard_common::smol_str::SmolStr::new_static( 662 "createdAt", 663 ), 664 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 665 description: None, 666 format: Some( 667 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 668 ), 669 default: None, 670 min_length: None, 671 max_length: None, 672 min_graphemes: None, 673 max_graphemes: None, 674 r#enum: None, 675 r#const: None, 676 known_values: None, 677 }), 678 ); 679 map.insert( 680 ::jacquard_common::smol_str::SmolStr::new_static("tag"), 681 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 682 description: None, 683 format: None, 684 default: None, 685 min_length: None, 686 max_length: None, 687 min_graphemes: None, 688 max_graphemes: None, 689 r#enum: None, 690 r#const: None, 691 known_values: None, 692 }), 693 ); 694 map.insert( 695 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 696 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 697 description: None, 698 format: Some( 699 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 700 ), 701 default: None, 702 min_length: None, 703 max_length: None, 704 min_graphemes: None, 705 max_graphemes: None, 706 r#enum: None, 707 r#const: None, 708 known_values: None, 709 }), 710 ); 711 map 712 }, 713 }), 714 ); 715 map.insert( 716 ::jacquard_common::smol_str::SmolStr::new_static("tagView"), 717 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 718 description: Some( 719 ::jacquard_common::CowStr::new_static( 720 "Aggregated view of a tag with usage statistics.", 721 ), 722 ), 723 required: Some( 724 vec![ 725 ::jacquard_common::smol_str::SmolStr::new_static("tag"), 726 ::jacquard_common::smol_str::SmolStr::new_static("useCount") 727 ], 728 ), 729 nullable: None, 730 properties: { 731 #[allow(unused_mut)] 732 let mut map = ::alloc::collections::BTreeMap::new(); 733 map.insert( 734 ::jacquard_common::smol_str::SmolStr::new_static( 735 "entryCount", 736 ), 737 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 738 description: None, 739 default: None, 740 minimum: None, 741 maximum: None, 742 r#enum: None, 743 r#const: None, 744 }), 745 ); 746 map.insert( 747 ::jacquard_common::smol_str::SmolStr::new_static( 748 "notebookCount", 749 ), 750 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 751 description: None, 752 default: None, 753 minimum: None, 754 maximum: None, 755 r#enum: None, 756 r#const: None, 757 }), 758 ); 759 map.insert( 760 ::jacquard_common::smol_str::SmolStr::new_static( 761 "recentUseCount", 762 ), 763 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 764 description: None, 765 default: None, 766 minimum: None, 767 maximum: None, 768 r#enum: None, 769 r#const: None, 770 }), 771 ); 772 map.insert( 773 ::jacquard_common::smol_str::SmolStr::new_static("tag"), 774 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 775 description: None, 776 format: None, 777 default: None, 778 min_length: None, 779 max_length: None, 780 min_graphemes: None, 781 max_graphemes: None, 782 r#enum: None, 783 r#const: None, 784 known_values: None, 785 }), 786 ); 787 map.insert( 788 ::jacquard_common::smol_str::SmolStr::new_static( 789 "trendingScore", 790 ), 791 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 792 description: None, 793 default: None, 794 minimum: None, 795 maximum: None, 796 r#enum: None, 797 r#const: None, 798 }), 799 ); 800 map.insert( 801 ::jacquard_common::smol_str::SmolStr::new_static("useCount"), 802 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 803 description: None, 804 default: None, 805 minimum: None, 806 maximum: None, 807 r#enum: None, 808 r#const: None, 809 }), 810 ); 811 map 812 }, 813 }), 814 ); 815 map 816 }, 817 } 818} 819 820impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CommunityTagCount<'a> { 821 fn nsid() -> &'static str { 822 "sh.weaver.graph.defs" 823 } 824 fn def_name() -> &'static str { 825 "communityTagCount" 826 } 827 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 828 lexicon_doc_sh_weaver_graph_defs() 829 } 830 fn validate( 831 &self, 832 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 833 Ok(()) 834 } 835} 836 837/// A curated collection of notebooks/entries for sharing. 838#[derive( 839 serde::Serialize, 840 serde::Deserialize, 841 Debug, 842 Clone, 843 PartialEq, 844 Eq, 845 Hash, 846 jacquard_derive::IntoStatic 847)] 848pub struct Curatelist; 849impl std::fmt::Display for Curatelist { 850 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 851 write!(f, "curatelist") 852 } 853} 854 855/// An item in a list with hydrated subject. 856#[jacquard_derive::lexicon] 857#[derive( 858 serde::Serialize, 859 serde::Deserialize, 860 Debug, 861 Clone, 862 PartialEq, 863 Eq, 864 jacquard_derive::IntoStatic 865)] 866#[serde(rename_all = "camelCase")] 867pub struct ListItemView<'a> { 868 #[serde(skip_serializing_if = "std::option::Option::is_none")] 869 pub added_at: std::option::Option<jacquard_common::types::string::Datetime>, 870 #[serde(borrow)] 871 pub subject: ListItemViewSubject<'a>, 872 #[serde(borrow)] 873 pub uri: jacquard_common::types::string::AtUri<'a>, 874} 875 876pub mod list_item_view_state { 877 878 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 879 #[allow(unused)] 880 use ::core::marker::PhantomData; 881 mod sealed { 882 pub trait Sealed {} 883 } 884 /// State trait tracking which required fields have been set 885 pub trait State: sealed::Sealed { 886 type Uri; 887 type Subject; 888 } 889 /// Empty state - all required fields are unset 890 pub struct Empty(()); 891 impl sealed::Sealed for Empty {} 892 impl State for Empty { 893 type Uri = Unset; 894 type Subject = Unset; 895 } 896 ///State transition - sets the `uri` field to Set 897 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 898 impl<S: State> sealed::Sealed for SetUri<S> {} 899 impl<S: State> State for SetUri<S> { 900 type Uri = Set<members::uri>; 901 type Subject = S::Subject; 902 } 903 ///State transition - sets the `subject` field to Set 904 pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); 905 impl<S: State> sealed::Sealed for SetSubject<S> {} 906 impl<S: State> State for SetSubject<S> { 907 type Uri = S::Uri; 908 type Subject = Set<members::subject>; 909 } 910 /// Marker types for field names 911 #[allow(non_camel_case_types)] 912 pub mod members { 913 ///Marker type for the `uri` field 914 pub struct uri(()); 915 ///Marker type for the `subject` field 916 pub struct subject(()); 917 } 918} 919 920/// Builder for constructing an instance of this type 921pub struct ListItemViewBuilder<'a, S: list_item_view_state::State> { 922 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 923 __unsafe_private_named: ( 924 ::core::option::Option<jacquard_common::types::string::Datetime>, 925 ::core::option::Option<ListItemViewSubject<'a>>, 926 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 927 ), 928 _phantom: ::core::marker::PhantomData<&'a ()>, 929} 930 931impl<'a> ListItemView<'a> { 932 /// Create a new builder for this type 933 pub fn new() -> ListItemViewBuilder<'a, list_item_view_state::Empty> { 934 ListItemViewBuilder::new() 935 } 936} 937 938impl<'a> ListItemViewBuilder<'a, list_item_view_state::Empty> { 939 /// Create a new builder with all fields unset 940 pub fn new() -> Self { 941 ListItemViewBuilder { 942 _phantom_state: ::core::marker::PhantomData, 943 __unsafe_private_named: (None, None, None), 944 _phantom: ::core::marker::PhantomData, 945 } 946 } 947} 948 949impl<'a, S: list_item_view_state::State> ListItemViewBuilder<'a, S> { 950 /// Set the `addedAt` field (optional) 951 pub fn added_at( 952 mut self, 953 value: impl Into<Option<jacquard_common::types::string::Datetime>>, 954 ) -> Self { 955 self.__unsafe_private_named.0 = value.into(); 956 self 957 } 958 /// Set the `addedAt` field to an Option value (optional) 959 pub fn maybe_added_at( 960 mut self, 961 value: Option<jacquard_common::types::string::Datetime>, 962 ) -> Self { 963 self.__unsafe_private_named.0 = value; 964 self 965 } 966} 967 968impl<'a, S> ListItemViewBuilder<'a, S> 969where 970 S: list_item_view_state::State, 971 S::Subject: list_item_view_state::IsUnset, 972{ 973 /// Set the `subject` field (required) 974 pub fn subject( 975 mut self, 976 value: impl Into<ListItemViewSubject<'a>>, 977 ) -> ListItemViewBuilder<'a, list_item_view_state::SetSubject<S>> { 978 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 979 ListItemViewBuilder { 980 _phantom_state: ::core::marker::PhantomData, 981 __unsafe_private_named: self.__unsafe_private_named, 982 _phantom: ::core::marker::PhantomData, 983 } 984 } 985} 986 987impl<'a, S> ListItemViewBuilder<'a, S> 988where 989 S: list_item_view_state::State, 990 S::Uri: list_item_view_state::IsUnset, 991{ 992 /// Set the `uri` field (required) 993 pub fn uri( 994 mut self, 995 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 996 ) -> ListItemViewBuilder<'a, list_item_view_state::SetUri<S>> { 997 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 998 ListItemViewBuilder { 999 _phantom_state: ::core::marker::PhantomData, 1000 __unsafe_private_named: self.__unsafe_private_named, 1001 _phantom: ::core::marker::PhantomData, 1002 } 1003 } 1004} 1005 1006impl<'a, S> ListItemViewBuilder<'a, S> 1007where 1008 S: list_item_view_state::State, 1009 S::Uri: list_item_view_state::IsSet, 1010 S::Subject: list_item_view_state::IsSet, 1011{ 1012 /// Build the final struct 1013 pub fn build(self) -> ListItemView<'a> { 1014 ListItemView { 1015 added_at: self.__unsafe_private_named.0, 1016 subject: self.__unsafe_private_named.1.unwrap(), 1017 uri: self.__unsafe_private_named.2.unwrap(), 1018 extra_data: Default::default(), 1019 } 1020 } 1021 /// Build the final struct with custom extra_data 1022 pub fn build_with_data( 1023 self, 1024 extra_data: std::collections::BTreeMap< 1025 jacquard_common::smol_str::SmolStr, 1026 jacquard_common::types::value::Data<'a>, 1027 >, 1028 ) -> ListItemView<'a> { 1029 ListItemView { 1030 added_at: self.__unsafe_private_named.0, 1031 subject: self.__unsafe_private_named.1.unwrap(), 1032 uri: self.__unsafe_private_named.2.unwrap(), 1033 extra_data: Some(extra_data), 1034 } 1035 } 1036} 1037 1038#[jacquard_derive::open_union] 1039#[derive( 1040 serde::Serialize, 1041 serde::Deserialize, 1042 Debug, 1043 Clone, 1044 PartialEq, 1045 Eq, 1046 jacquard_derive::IntoStatic 1047)] 1048#[serde(tag = "$type")] 1049#[serde(bound(deserialize = "'de: 'a"))] 1050pub enum ListItemViewSubject<'a> { 1051 #[serde(rename = "sh.weaver.notebook.defs#notebookView")] 1052 NotebookView(Box<crate::sh_weaver::notebook::NotebookView<'a>>), 1053 #[serde(rename = "sh.weaver.notebook.defs#entryView")] 1054 EntryView(Box<crate::sh_weaver::notebook::EntryView<'a>>), 1055} 1056 1057impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListItemView<'a> { 1058 fn nsid() -> &'static str { 1059 "sh.weaver.graph.defs" 1060 } 1061 fn def_name() -> &'static str { 1062 "listItemView" 1063 } 1064 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1065 lexicon_doc_sh_weaver_graph_defs() 1066 } 1067 fn validate( 1068 &self, 1069 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1070 Ok(()) 1071 } 1072} 1073 1074#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1075pub enum ListPurpose<'a> { 1076 ShWeaverGraphDefsCuratelist, 1077 ShWeaverGraphDefsReadinglist, 1078 ShWeaverGraphDefsSerieslist, 1079 Other(jacquard_common::CowStr<'a>), 1080} 1081 1082impl<'a> ListPurpose<'a> { 1083 pub fn as_str(&self) -> &str { 1084 match self { 1085 Self::ShWeaverGraphDefsCuratelist => "sh.weaver.graph.defs#curatelist", 1086 Self::ShWeaverGraphDefsReadinglist => "sh.weaver.graph.defs#readinglist", 1087 Self::ShWeaverGraphDefsSerieslist => "sh.weaver.graph.defs#serieslist", 1088 Self::Other(s) => s.as_ref(), 1089 } 1090 } 1091} 1092 1093impl<'a> From<&'a str> for ListPurpose<'a> { 1094 fn from(s: &'a str) -> Self { 1095 match s { 1096 "sh.weaver.graph.defs#curatelist" => Self::ShWeaverGraphDefsCuratelist, 1097 "sh.weaver.graph.defs#readinglist" => Self::ShWeaverGraphDefsReadinglist, 1098 "sh.weaver.graph.defs#serieslist" => Self::ShWeaverGraphDefsSerieslist, 1099 _ => Self::Other(jacquard_common::CowStr::from(s)), 1100 } 1101 } 1102} 1103 1104impl<'a> From<String> for ListPurpose<'a> { 1105 fn from(s: String) -> Self { 1106 match s.as_str() { 1107 "sh.weaver.graph.defs#curatelist" => Self::ShWeaverGraphDefsCuratelist, 1108 "sh.weaver.graph.defs#readinglist" => Self::ShWeaverGraphDefsReadinglist, 1109 "sh.weaver.graph.defs#serieslist" => Self::ShWeaverGraphDefsSerieslist, 1110 _ => Self::Other(jacquard_common::CowStr::from(s)), 1111 } 1112 } 1113} 1114 1115impl<'a> AsRef<str> for ListPurpose<'a> { 1116 fn as_ref(&self) -> &str { 1117 self.as_str() 1118 } 1119} 1120 1121impl<'a> core::fmt::Display for ListPurpose<'a> { 1122 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 1123 write!(f, "{}", self.as_str()) 1124 } 1125} 1126 1127impl<'a> serde::Serialize for ListPurpose<'a> { 1128 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> 1129 where 1130 S: serde::Serializer, 1131 { 1132 serializer.serialize_str(self.as_str()) 1133 } 1134} 1135 1136impl<'de, 'a> serde::Deserialize<'de> for ListPurpose<'a> 1137where 1138 'de: 'a, 1139{ 1140 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 1141 where 1142 D: serde::Deserializer<'de>, 1143 { 1144 let s = <&'de str>::deserialize(deserializer)?; 1145 Ok(Self::from(s)) 1146 } 1147} 1148 1149impl jacquard_common::IntoStatic for ListPurpose<'_> { 1150 type Output = ListPurpose<'static>; 1151 fn into_static(self) -> Self::Output { 1152 match self { 1153 ListPurpose::ShWeaverGraphDefsCuratelist => { 1154 ListPurpose::ShWeaverGraphDefsCuratelist 1155 } 1156 ListPurpose::ShWeaverGraphDefsReadinglist => { 1157 ListPurpose::ShWeaverGraphDefsReadinglist 1158 } 1159 ListPurpose::ShWeaverGraphDefsSerieslist => { 1160 ListPurpose::ShWeaverGraphDefsSerieslist 1161 } 1162 ListPurpose::Other(v) => ListPurpose::Other(v.into_static()), 1163 } 1164 } 1165} 1166 1167/// Hydrated view of a list. 1168#[jacquard_derive::lexicon] 1169#[derive( 1170 serde::Serialize, 1171 serde::Deserialize, 1172 Debug, 1173 Clone, 1174 PartialEq, 1175 Eq, 1176 jacquard_derive::IntoStatic 1177)] 1178#[serde(rename_all = "camelCase")] 1179pub struct ListView<'a> { 1180 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1181 #[serde(borrow)] 1182 pub avatar: std::option::Option<jacquard_common::types::string::Uri<'a>>, 1183 #[serde(borrow)] 1184 pub cid: jacquard_common::types::string::Cid<'a>, 1185 #[serde(borrow)] 1186 pub creator: crate::sh_weaver::actor::ProfileViewBasic<'a>, 1187 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1188 #[serde(borrow)] 1189 pub description: std::option::Option<jacquard_common::CowStr<'a>>, 1190 pub indexed_at: jacquard_common::types::string::Datetime, 1191 pub item_count: i64, 1192 #[serde(borrow)] 1193 pub name: jacquard_common::CowStr<'a>, 1194 #[serde(borrow)] 1195 pub purpose: crate::sh_weaver::graph::ListPurpose<'a>, 1196 #[serde(borrow)] 1197 pub uri: jacquard_common::types::string::AtUri<'a>, 1198 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1199 #[serde(borrow)] 1200 pub viewer_subscribed: std::option::Option< 1201 jacquard_common::types::string::AtUri<'a>, 1202 >, 1203} 1204 1205pub mod list_view_state { 1206 1207 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1208 #[allow(unused)] 1209 use ::core::marker::PhantomData; 1210 mod sealed { 1211 pub trait Sealed {} 1212 } 1213 /// State trait tracking which required fields have been set 1214 pub trait State: sealed::Sealed { 1215 type Uri; 1216 type ItemCount; 1217 type Creator; 1218 type Cid; 1219 type Name; 1220 type Purpose; 1221 type IndexedAt; 1222 } 1223 /// Empty state - all required fields are unset 1224 pub struct Empty(()); 1225 impl sealed::Sealed for Empty {} 1226 impl State for Empty { 1227 type Uri = Unset; 1228 type ItemCount = Unset; 1229 type Creator = Unset; 1230 type Cid = Unset; 1231 type Name = Unset; 1232 type Purpose = Unset; 1233 type IndexedAt = Unset; 1234 } 1235 ///State transition - sets the `uri` field to Set 1236 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1237 impl<S: State> sealed::Sealed for SetUri<S> {} 1238 impl<S: State> State for SetUri<S> { 1239 type Uri = Set<members::uri>; 1240 type ItemCount = S::ItemCount; 1241 type Creator = S::Creator; 1242 type Cid = S::Cid; 1243 type Name = S::Name; 1244 type Purpose = S::Purpose; 1245 type IndexedAt = S::IndexedAt; 1246 } 1247 ///State transition - sets the `item_count` field to Set 1248 pub struct SetItemCount<S: State = Empty>(PhantomData<fn() -> S>); 1249 impl<S: State> sealed::Sealed for SetItemCount<S> {} 1250 impl<S: State> State for SetItemCount<S> { 1251 type Uri = S::Uri; 1252 type ItemCount = Set<members::item_count>; 1253 type Creator = S::Creator; 1254 type Cid = S::Cid; 1255 type Name = S::Name; 1256 type Purpose = S::Purpose; 1257 type IndexedAt = S::IndexedAt; 1258 } 1259 ///State transition - sets the `creator` field to Set 1260 pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); 1261 impl<S: State> sealed::Sealed for SetCreator<S> {} 1262 impl<S: State> State for SetCreator<S> { 1263 type Uri = S::Uri; 1264 type ItemCount = S::ItemCount; 1265 type Creator = Set<members::creator>; 1266 type Cid = S::Cid; 1267 type Name = S::Name; 1268 type Purpose = S::Purpose; 1269 type IndexedAt = S::IndexedAt; 1270 } 1271 ///State transition - sets the `cid` field to Set 1272 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 1273 impl<S: State> sealed::Sealed for SetCid<S> {} 1274 impl<S: State> State for SetCid<S> { 1275 type Uri = S::Uri; 1276 type ItemCount = S::ItemCount; 1277 type Creator = S::Creator; 1278 type Cid = Set<members::cid>; 1279 type Name = S::Name; 1280 type Purpose = S::Purpose; 1281 type IndexedAt = S::IndexedAt; 1282 } 1283 ///State transition - sets the `name` field to Set 1284 pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); 1285 impl<S: State> sealed::Sealed for SetName<S> {} 1286 impl<S: State> State for SetName<S> { 1287 type Uri = S::Uri; 1288 type ItemCount = S::ItemCount; 1289 type Creator = S::Creator; 1290 type Cid = S::Cid; 1291 type Name = Set<members::name>; 1292 type Purpose = S::Purpose; 1293 type IndexedAt = S::IndexedAt; 1294 } 1295 ///State transition - sets the `purpose` field to Set 1296 pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); 1297 impl<S: State> sealed::Sealed for SetPurpose<S> {} 1298 impl<S: State> State for SetPurpose<S> { 1299 type Uri = S::Uri; 1300 type ItemCount = S::ItemCount; 1301 type Creator = S::Creator; 1302 type Cid = S::Cid; 1303 type Name = S::Name; 1304 type Purpose = Set<members::purpose>; 1305 type IndexedAt = S::IndexedAt; 1306 } 1307 ///State transition - sets the `indexed_at` field to Set 1308 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); 1309 impl<S: State> sealed::Sealed for SetIndexedAt<S> {} 1310 impl<S: State> State for SetIndexedAt<S> { 1311 type Uri = S::Uri; 1312 type ItemCount = S::ItemCount; 1313 type Creator = S::Creator; 1314 type Cid = S::Cid; 1315 type Name = S::Name; 1316 type Purpose = S::Purpose; 1317 type IndexedAt = Set<members::indexed_at>; 1318 } 1319 /// Marker types for field names 1320 #[allow(non_camel_case_types)] 1321 pub mod members { 1322 ///Marker type for the `uri` field 1323 pub struct uri(()); 1324 ///Marker type for the `item_count` field 1325 pub struct item_count(()); 1326 ///Marker type for the `creator` field 1327 pub struct creator(()); 1328 ///Marker type for the `cid` field 1329 pub struct cid(()); 1330 ///Marker type for the `name` field 1331 pub struct name(()); 1332 ///Marker type for the `purpose` field 1333 pub struct purpose(()); 1334 ///Marker type for the `indexed_at` field 1335 pub struct indexed_at(()); 1336 } 1337} 1338 1339/// Builder for constructing an instance of this type 1340pub struct ListViewBuilder<'a, S: list_view_state::State> { 1341 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1342 __unsafe_private_named: ( 1343 ::core::option::Option<jacquard_common::types::string::Uri<'a>>, 1344 ::core::option::Option<jacquard_common::types::string::Cid<'a>>, 1345 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>, 1346 ::core::option::Option<jacquard_common::CowStr<'a>>, 1347 ::core::option::Option<jacquard_common::types::string::Datetime>, 1348 ::core::option::Option<i64>, 1349 ::core::option::Option<jacquard_common::CowStr<'a>>, 1350 ::core::option::Option<crate::sh_weaver::graph::ListPurpose<'a>>, 1351 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1352 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1353 ), 1354 _phantom: ::core::marker::PhantomData<&'a ()>, 1355} 1356 1357impl<'a> ListView<'a> { 1358 /// Create a new builder for this type 1359 pub fn new() -> ListViewBuilder<'a, list_view_state::Empty> { 1360 ListViewBuilder::new() 1361 } 1362} 1363 1364impl<'a> ListViewBuilder<'a, list_view_state::Empty> { 1365 /// Create a new builder with all fields unset 1366 pub fn new() -> Self { 1367 ListViewBuilder { 1368 _phantom_state: ::core::marker::PhantomData, 1369 __unsafe_private_named: ( 1370 None, 1371 None, 1372 None, 1373 None, 1374 None, 1375 None, 1376 None, 1377 None, 1378 None, 1379 None, 1380 ), 1381 _phantom: ::core::marker::PhantomData, 1382 } 1383 } 1384} 1385 1386impl<'a, S: list_view_state::State> ListViewBuilder<'a, S> { 1387 /// Set the `avatar` field (optional) 1388 pub fn avatar( 1389 mut self, 1390 value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>, 1391 ) -> Self { 1392 self.__unsafe_private_named.0 = value.into(); 1393 self 1394 } 1395 /// Set the `avatar` field to an Option value (optional) 1396 pub fn maybe_avatar( 1397 mut self, 1398 value: Option<jacquard_common::types::string::Uri<'a>>, 1399 ) -> Self { 1400 self.__unsafe_private_named.0 = value; 1401 self 1402 } 1403} 1404 1405impl<'a, S> ListViewBuilder<'a, S> 1406where 1407 S: list_view_state::State, 1408 S::Cid: list_view_state::IsUnset, 1409{ 1410 /// Set the `cid` field (required) 1411 pub fn cid( 1412 mut self, 1413 value: impl Into<jacquard_common::types::string::Cid<'a>>, 1414 ) -> ListViewBuilder<'a, list_view_state::SetCid<S>> { 1415 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1416 ListViewBuilder { 1417 _phantom_state: ::core::marker::PhantomData, 1418 __unsafe_private_named: self.__unsafe_private_named, 1419 _phantom: ::core::marker::PhantomData, 1420 } 1421 } 1422} 1423 1424impl<'a, S> ListViewBuilder<'a, S> 1425where 1426 S: list_view_state::State, 1427 S::Creator: list_view_state::IsUnset, 1428{ 1429 /// Set the `creator` field (required) 1430 pub fn creator( 1431 mut self, 1432 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>, 1433 ) -> ListViewBuilder<'a, list_view_state::SetCreator<S>> { 1434 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 1435 ListViewBuilder { 1436 _phantom_state: ::core::marker::PhantomData, 1437 __unsafe_private_named: self.__unsafe_private_named, 1438 _phantom: ::core::marker::PhantomData, 1439 } 1440 } 1441} 1442 1443impl<'a, S: list_view_state::State> ListViewBuilder<'a, S> { 1444 /// Set the `description` field (optional) 1445 pub fn description( 1446 mut self, 1447 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 1448 ) -> Self { 1449 self.__unsafe_private_named.3 = value.into(); 1450 self 1451 } 1452 /// Set the `description` field to an Option value (optional) 1453 pub fn maybe_description( 1454 mut self, 1455 value: Option<jacquard_common::CowStr<'a>>, 1456 ) -> Self { 1457 self.__unsafe_private_named.3 = value; 1458 self 1459 } 1460} 1461 1462impl<'a, S> ListViewBuilder<'a, S> 1463where 1464 S: list_view_state::State, 1465 S::IndexedAt: list_view_state::IsUnset, 1466{ 1467 /// Set the `indexedAt` field (required) 1468 pub fn indexed_at( 1469 mut self, 1470 value: impl Into<jacquard_common::types::string::Datetime>, 1471 ) -> ListViewBuilder<'a, list_view_state::SetIndexedAt<S>> { 1472 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); 1473 ListViewBuilder { 1474 _phantom_state: ::core::marker::PhantomData, 1475 __unsafe_private_named: self.__unsafe_private_named, 1476 _phantom: ::core::marker::PhantomData, 1477 } 1478 } 1479} 1480 1481impl<'a, S> ListViewBuilder<'a, S> 1482where 1483 S: list_view_state::State, 1484 S::ItemCount: list_view_state::IsUnset, 1485{ 1486 /// Set the `itemCount` field (required) 1487 pub fn item_count( 1488 mut self, 1489 value: impl Into<i64>, 1490 ) -> ListViewBuilder<'a, list_view_state::SetItemCount<S>> { 1491 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); 1492 ListViewBuilder { 1493 _phantom_state: ::core::marker::PhantomData, 1494 __unsafe_private_named: self.__unsafe_private_named, 1495 _phantom: ::core::marker::PhantomData, 1496 } 1497 } 1498} 1499 1500impl<'a, S> ListViewBuilder<'a, S> 1501where 1502 S: list_view_state::State, 1503 S::Name: list_view_state::IsUnset, 1504{ 1505 /// Set the `name` field (required) 1506 pub fn name( 1507 mut self, 1508 value: impl Into<jacquard_common::CowStr<'a>>, 1509 ) -> ListViewBuilder<'a, list_view_state::SetName<S>> { 1510 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); 1511 ListViewBuilder { 1512 _phantom_state: ::core::marker::PhantomData, 1513 __unsafe_private_named: self.__unsafe_private_named, 1514 _phantom: ::core::marker::PhantomData, 1515 } 1516 } 1517} 1518 1519impl<'a, S> ListViewBuilder<'a, S> 1520where 1521 S: list_view_state::State, 1522 S::Purpose: list_view_state::IsUnset, 1523{ 1524 /// Set the `purpose` field (required) 1525 pub fn purpose( 1526 mut self, 1527 value: impl Into<crate::sh_weaver::graph::ListPurpose<'a>>, 1528 ) -> ListViewBuilder<'a, list_view_state::SetPurpose<S>> { 1529 self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); 1530 ListViewBuilder { 1531 _phantom_state: ::core::marker::PhantomData, 1532 __unsafe_private_named: self.__unsafe_private_named, 1533 _phantom: ::core::marker::PhantomData, 1534 } 1535 } 1536} 1537 1538impl<'a, S> ListViewBuilder<'a, S> 1539where 1540 S: list_view_state::State, 1541 S::Uri: list_view_state::IsUnset, 1542{ 1543 /// Set the `uri` field (required) 1544 pub fn uri( 1545 mut self, 1546 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1547 ) -> ListViewBuilder<'a, list_view_state::SetUri<S>> { 1548 self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); 1549 ListViewBuilder { 1550 _phantom_state: ::core::marker::PhantomData, 1551 __unsafe_private_named: self.__unsafe_private_named, 1552 _phantom: ::core::marker::PhantomData, 1553 } 1554 } 1555} 1556 1557impl<'a, S: list_view_state::State> ListViewBuilder<'a, S> { 1558 /// Set the `viewerSubscribed` field (optional) 1559 pub fn viewer_subscribed( 1560 mut self, 1561 value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>, 1562 ) -> Self { 1563 self.__unsafe_private_named.9 = value.into(); 1564 self 1565 } 1566 /// Set the `viewerSubscribed` field to an Option value (optional) 1567 pub fn maybe_viewer_subscribed( 1568 mut self, 1569 value: Option<jacquard_common::types::string::AtUri<'a>>, 1570 ) -> Self { 1571 self.__unsafe_private_named.9 = value; 1572 self 1573 } 1574} 1575 1576impl<'a, S> ListViewBuilder<'a, S> 1577where 1578 S: list_view_state::State, 1579 S::Uri: list_view_state::IsSet, 1580 S::ItemCount: list_view_state::IsSet, 1581 S::Creator: list_view_state::IsSet, 1582 S::Cid: list_view_state::IsSet, 1583 S::Name: list_view_state::IsSet, 1584 S::Purpose: list_view_state::IsSet, 1585 S::IndexedAt: list_view_state::IsSet, 1586{ 1587 /// Build the final struct 1588 pub fn build(self) -> ListView<'a> { 1589 ListView { 1590 avatar: self.__unsafe_private_named.0, 1591 cid: self.__unsafe_private_named.1.unwrap(), 1592 creator: self.__unsafe_private_named.2.unwrap(), 1593 description: self.__unsafe_private_named.3, 1594 indexed_at: self.__unsafe_private_named.4.unwrap(), 1595 item_count: self.__unsafe_private_named.5.unwrap(), 1596 name: self.__unsafe_private_named.6.unwrap(), 1597 purpose: self.__unsafe_private_named.7.unwrap(), 1598 uri: self.__unsafe_private_named.8.unwrap(), 1599 viewer_subscribed: self.__unsafe_private_named.9, 1600 extra_data: Default::default(), 1601 } 1602 } 1603 /// Build the final struct with custom extra_data 1604 pub fn build_with_data( 1605 self, 1606 extra_data: std::collections::BTreeMap< 1607 jacquard_common::smol_str::SmolStr, 1608 jacquard_common::types::value::Data<'a>, 1609 >, 1610 ) -> ListView<'a> { 1611 ListView { 1612 avatar: self.__unsafe_private_named.0, 1613 cid: self.__unsafe_private_named.1.unwrap(), 1614 creator: self.__unsafe_private_named.2.unwrap(), 1615 description: self.__unsafe_private_named.3, 1616 indexed_at: self.__unsafe_private_named.4.unwrap(), 1617 item_count: self.__unsafe_private_named.5.unwrap(), 1618 name: self.__unsafe_private_named.6.unwrap(), 1619 purpose: self.__unsafe_private_named.7.unwrap(), 1620 uri: self.__unsafe_private_named.8.unwrap(), 1621 viewer_subscribed: self.__unsafe_private_named.9, 1622 extra_data: Some(extra_data), 1623 } 1624 } 1625} 1626 1627impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListView<'a> { 1628 fn nsid() -> &'static str { 1629 "sh.weaver.graph.defs" 1630 } 1631 fn def_name() -> &'static str { 1632 "listView" 1633 } 1634 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1635 lexicon_doc_sh_weaver_graph_defs() 1636 } 1637 fn validate( 1638 &self, 1639 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1640 Ok(()) 1641 } 1642} 1643 1644/// A personal reading list. 1645#[derive( 1646 serde::Serialize, 1647 serde::Deserialize, 1648 Debug, 1649 Clone, 1650 PartialEq, 1651 Eq, 1652 Hash, 1653 jacquard_derive::IntoStatic 1654)] 1655pub struct Readinglist; 1656impl std::fmt::Display for Readinglist { 1657 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 1658 write!(f, "readinglist") 1659 } 1660} 1661 1662/// All tags for a resource, grouped by source. 1663#[jacquard_derive::lexicon] 1664#[derive( 1665 serde::Serialize, 1666 serde::Deserialize, 1667 Debug, 1668 Clone, 1669 PartialEq, 1670 Eq, 1671 jacquard_derive::IntoStatic 1672)] 1673#[serde(rename_all = "camelCase")] 1674pub struct ResourceTagsView<'a> { 1675 /// Tags from the record itself (author-applied). 1676 #[serde(borrow)] 1677 pub author_tags: Vec<jacquard_common::CowStr<'a>>, 1678 /// Aggregated community-applied tags with counts. 1679 #[serde(borrow)] 1680 pub community_tags: Vec<crate::sh_weaver::graph::CommunityTagCount<'a>>, 1681 #[serde(borrow)] 1682 pub resource: crate::com_atproto::repo::strong_ref::StrongRef<'a>, 1683 /// Tags the current viewer has applied. 1684 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1685 #[serde(borrow)] 1686 pub viewer_applied_tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, 1687} 1688 1689pub mod resource_tags_view_state { 1690 1691 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1692 #[allow(unused)] 1693 use ::core::marker::PhantomData; 1694 mod sealed { 1695 pub trait Sealed {} 1696 } 1697 /// State trait tracking which required fields have been set 1698 pub trait State: sealed::Sealed { 1699 type CommunityTags; 1700 type Resource; 1701 type AuthorTags; 1702 } 1703 /// Empty state - all required fields are unset 1704 pub struct Empty(()); 1705 impl sealed::Sealed for Empty {} 1706 impl State for Empty { 1707 type CommunityTags = Unset; 1708 type Resource = Unset; 1709 type AuthorTags = Unset; 1710 } 1711 ///State transition - sets the `community_tags` field to Set 1712 pub struct SetCommunityTags<S: State = Empty>(PhantomData<fn() -> S>); 1713 impl<S: State> sealed::Sealed for SetCommunityTags<S> {} 1714 impl<S: State> State for SetCommunityTags<S> { 1715 type CommunityTags = Set<members::community_tags>; 1716 type Resource = S::Resource; 1717 type AuthorTags = S::AuthorTags; 1718 } 1719 ///State transition - sets the `resource` field to Set 1720 pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); 1721 impl<S: State> sealed::Sealed for SetResource<S> {} 1722 impl<S: State> State for SetResource<S> { 1723 type CommunityTags = S::CommunityTags; 1724 type Resource = Set<members::resource>; 1725 type AuthorTags = S::AuthorTags; 1726 } 1727 ///State transition - sets the `author_tags` field to Set 1728 pub struct SetAuthorTags<S: State = Empty>(PhantomData<fn() -> S>); 1729 impl<S: State> sealed::Sealed for SetAuthorTags<S> {} 1730 impl<S: State> State for SetAuthorTags<S> { 1731 type CommunityTags = S::CommunityTags; 1732 type Resource = S::Resource; 1733 type AuthorTags = Set<members::author_tags>; 1734 } 1735 /// Marker types for field names 1736 #[allow(non_camel_case_types)] 1737 pub mod members { 1738 ///Marker type for the `community_tags` field 1739 pub struct community_tags(()); 1740 ///Marker type for the `resource` field 1741 pub struct resource(()); 1742 ///Marker type for the `author_tags` field 1743 pub struct author_tags(()); 1744 } 1745} 1746 1747/// Builder for constructing an instance of this type 1748pub struct ResourceTagsViewBuilder<'a, S: resource_tags_view_state::State> { 1749 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1750 __unsafe_private_named: ( 1751 ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, 1752 ::core::option::Option<Vec<crate::sh_weaver::graph::CommunityTagCount<'a>>>, 1753 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 1754 ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, 1755 ), 1756 _phantom: ::core::marker::PhantomData<&'a ()>, 1757} 1758 1759impl<'a> ResourceTagsView<'a> { 1760 /// Create a new builder for this type 1761 pub fn new() -> ResourceTagsViewBuilder<'a, resource_tags_view_state::Empty> { 1762 ResourceTagsViewBuilder::new() 1763 } 1764} 1765 1766impl<'a> ResourceTagsViewBuilder<'a, resource_tags_view_state::Empty> { 1767 /// Create a new builder with all fields unset 1768 pub fn new() -> Self { 1769 ResourceTagsViewBuilder { 1770 _phantom_state: ::core::marker::PhantomData, 1771 __unsafe_private_named: (None, None, None, None), 1772 _phantom: ::core::marker::PhantomData, 1773 } 1774 } 1775} 1776 1777impl<'a, S> ResourceTagsViewBuilder<'a, S> 1778where 1779 S: resource_tags_view_state::State, 1780 S::AuthorTags: resource_tags_view_state::IsUnset, 1781{ 1782 /// Set the `authorTags` field (required) 1783 pub fn author_tags( 1784 mut self, 1785 value: impl Into<Vec<jacquard_common::CowStr<'a>>>, 1786 ) -> ResourceTagsViewBuilder<'a, resource_tags_view_state::SetAuthorTags<S>> { 1787 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1788 ResourceTagsViewBuilder { 1789 _phantom_state: ::core::marker::PhantomData, 1790 __unsafe_private_named: self.__unsafe_private_named, 1791 _phantom: ::core::marker::PhantomData, 1792 } 1793 } 1794} 1795 1796impl<'a, S> ResourceTagsViewBuilder<'a, S> 1797where 1798 S: resource_tags_view_state::State, 1799 S::CommunityTags: resource_tags_view_state::IsUnset, 1800{ 1801 /// Set the `communityTags` field (required) 1802 pub fn community_tags( 1803 mut self, 1804 value: impl Into<Vec<crate::sh_weaver::graph::CommunityTagCount<'a>>>, 1805 ) -> ResourceTagsViewBuilder<'a, resource_tags_view_state::SetCommunityTags<S>> { 1806 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1807 ResourceTagsViewBuilder { 1808 _phantom_state: ::core::marker::PhantomData, 1809 __unsafe_private_named: self.__unsafe_private_named, 1810 _phantom: ::core::marker::PhantomData, 1811 } 1812 } 1813} 1814 1815impl<'a, S> ResourceTagsViewBuilder<'a, S> 1816where 1817 S: resource_tags_view_state::State, 1818 S::Resource: resource_tags_view_state::IsUnset, 1819{ 1820 /// Set the `resource` field (required) 1821 pub fn resource( 1822 mut self, 1823 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 1824 ) -> ResourceTagsViewBuilder<'a, resource_tags_view_state::SetResource<S>> { 1825 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 1826 ResourceTagsViewBuilder { 1827 _phantom_state: ::core::marker::PhantomData, 1828 __unsafe_private_named: self.__unsafe_private_named, 1829 _phantom: ::core::marker::PhantomData, 1830 } 1831 } 1832} 1833 1834impl<'a, S: resource_tags_view_state::State> ResourceTagsViewBuilder<'a, S> { 1835 /// Set the `viewerAppliedTags` field (optional) 1836 pub fn viewer_applied_tags( 1837 mut self, 1838 value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, 1839 ) -> Self { 1840 self.__unsafe_private_named.3 = value.into(); 1841 self 1842 } 1843 /// Set the `viewerAppliedTags` field to an Option value (optional) 1844 pub fn maybe_viewer_applied_tags( 1845 mut self, 1846 value: Option<Vec<jacquard_common::CowStr<'a>>>, 1847 ) -> Self { 1848 self.__unsafe_private_named.3 = value; 1849 self 1850 } 1851} 1852 1853impl<'a, S> ResourceTagsViewBuilder<'a, S> 1854where 1855 S: resource_tags_view_state::State, 1856 S::CommunityTags: resource_tags_view_state::IsSet, 1857 S::Resource: resource_tags_view_state::IsSet, 1858 S::AuthorTags: resource_tags_view_state::IsSet, 1859{ 1860 /// Build the final struct 1861 pub fn build(self) -> ResourceTagsView<'a> { 1862 ResourceTagsView { 1863 author_tags: self.__unsafe_private_named.0.unwrap(), 1864 community_tags: self.__unsafe_private_named.1.unwrap(), 1865 resource: self.__unsafe_private_named.2.unwrap(), 1866 viewer_applied_tags: self.__unsafe_private_named.3, 1867 extra_data: Default::default(), 1868 } 1869 } 1870 /// Build the final struct with custom extra_data 1871 pub fn build_with_data( 1872 self, 1873 extra_data: std::collections::BTreeMap< 1874 jacquard_common::smol_str::SmolStr, 1875 jacquard_common::types::value::Data<'a>, 1876 >, 1877 ) -> ResourceTagsView<'a> { 1878 ResourceTagsView { 1879 author_tags: self.__unsafe_private_named.0.unwrap(), 1880 community_tags: self.__unsafe_private_named.1.unwrap(), 1881 resource: self.__unsafe_private_named.2.unwrap(), 1882 viewer_applied_tags: self.__unsafe_private_named.3, 1883 extra_data: Some(extra_data), 1884 } 1885 } 1886} 1887 1888impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ResourceTagsView<'a> { 1889 fn nsid() -> &'static str { 1890 "sh.weaver.graph.defs" 1891 } 1892 fn def_name() -> &'static str { 1893 "resourceTagsView" 1894 } 1895 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1896 lexicon_doc_sh_weaver_graph_defs() 1897 } 1898 fn validate( 1899 &self, 1900 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1901 Ok(()) 1902 } 1903} 1904 1905/// An ordered series of related works (sequels, spin-offs). 1906#[derive( 1907 serde::Serialize, 1908 serde::Deserialize, 1909 Debug, 1910 Clone, 1911 PartialEq, 1912 Eq, 1913 Hash, 1914 jacquard_derive::IntoStatic 1915)] 1916pub struct Serieslist; 1917impl std::fmt::Display for Serieslist { 1918 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 1919 write!(f, "serieslist") 1920 } 1921} 1922 1923/// A single tag application with who applied it. 1924#[jacquard_derive::lexicon] 1925#[derive( 1926 serde::Serialize, 1927 serde::Deserialize, 1928 Debug, 1929 Clone, 1930 PartialEq, 1931 Eq, 1932 jacquard_derive::IntoStatic 1933)] 1934#[serde(rename_all = "camelCase")] 1935pub struct TagApplicationView<'a> { 1936 #[serde(borrow)] 1937 pub applied_by: crate::sh_weaver::actor::ProfileViewBasic<'a>, 1938 pub created_at: jacquard_common::types::string::Datetime, 1939 #[serde(borrow)] 1940 pub tag: jacquard_common::CowStr<'a>, 1941 #[serde(borrow)] 1942 pub uri: jacquard_common::types::string::AtUri<'a>, 1943} 1944 1945pub mod tag_application_view_state { 1946 1947 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1948 #[allow(unused)] 1949 use ::core::marker::PhantomData; 1950 mod sealed { 1951 pub trait Sealed {} 1952 } 1953 /// State trait tracking which required fields have been set 1954 pub trait State: sealed::Sealed { 1955 type AppliedBy; 1956 type Uri; 1957 type Tag; 1958 type CreatedAt; 1959 } 1960 /// Empty state - all required fields are unset 1961 pub struct Empty(()); 1962 impl sealed::Sealed for Empty {} 1963 impl State for Empty { 1964 type AppliedBy = Unset; 1965 type Uri = Unset; 1966 type Tag = Unset; 1967 type CreatedAt = Unset; 1968 } 1969 ///State transition - sets the `applied_by` field to Set 1970 pub struct SetAppliedBy<S: State = Empty>(PhantomData<fn() -> S>); 1971 impl<S: State> sealed::Sealed for SetAppliedBy<S> {} 1972 impl<S: State> State for SetAppliedBy<S> { 1973 type AppliedBy = Set<members::applied_by>; 1974 type Uri = S::Uri; 1975 type Tag = S::Tag; 1976 type CreatedAt = S::CreatedAt; 1977 } 1978 ///State transition - sets the `uri` field to Set 1979 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1980 impl<S: State> sealed::Sealed for SetUri<S> {} 1981 impl<S: State> State for SetUri<S> { 1982 type AppliedBy = S::AppliedBy; 1983 type Uri = Set<members::uri>; 1984 type Tag = S::Tag; 1985 type CreatedAt = S::CreatedAt; 1986 } 1987 ///State transition - sets the `tag` field to Set 1988 pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); 1989 impl<S: State> sealed::Sealed for SetTag<S> {} 1990 impl<S: State> State for SetTag<S> { 1991 type AppliedBy = S::AppliedBy; 1992 type Uri = S::Uri; 1993 type Tag = Set<members::tag>; 1994 type CreatedAt = S::CreatedAt; 1995 } 1996 ///State transition - sets the `created_at` field to Set 1997 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); 1998 impl<S: State> sealed::Sealed for SetCreatedAt<S> {} 1999 impl<S: State> State for SetCreatedAt<S> { 2000 type AppliedBy = S::AppliedBy; 2001 type Uri = S::Uri; 2002 type Tag = S::Tag; 2003 type CreatedAt = Set<members::created_at>; 2004 } 2005 /// Marker types for field names 2006 #[allow(non_camel_case_types)] 2007 pub mod members { 2008 ///Marker type for the `applied_by` field 2009 pub struct applied_by(()); 2010 ///Marker type for the `uri` field 2011 pub struct uri(()); 2012 ///Marker type for the `tag` field 2013 pub struct tag(()); 2014 ///Marker type for the `created_at` field 2015 pub struct created_at(()); 2016 } 2017} 2018 2019/// Builder for constructing an instance of this type 2020pub struct TagApplicationViewBuilder<'a, S: tag_application_view_state::State> { 2021 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 2022 __unsafe_private_named: ( 2023 ::core::option::Option<crate::sh_weaver::actor::ProfileViewBasic<'a>>, 2024 ::core::option::Option<jacquard_common::types::string::Datetime>, 2025 ::core::option::Option<jacquard_common::CowStr<'a>>, 2026 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 2027 ), 2028 _phantom: ::core::marker::PhantomData<&'a ()>, 2029} 2030 2031impl<'a> TagApplicationView<'a> { 2032 /// Create a new builder for this type 2033 pub fn new() -> TagApplicationViewBuilder<'a, tag_application_view_state::Empty> { 2034 TagApplicationViewBuilder::new() 2035 } 2036} 2037 2038impl<'a> TagApplicationViewBuilder<'a, tag_application_view_state::Empty> { 2039 /// Create a new builder with all fields unset 2040 pub fn new() -> Self { 2041 TagApplicationViewBuilder { 2042 _phantom_state: ::core::marker::PhantomData, 2043 __unsafe_private_named: (None, None, None, None), 2044 _phantom: ::core::marker::PhantomData, 2045 } 2046 } 2047} 2048 2049impl<'a, S> TagApplicationViewBuilder<'a, S> 2050where 2051 S: tag_application_view_state::State, 2052 S::AppliedBy: tag_application_view_state::IsUnset, 2053{ 2054 /// Set the `appliedBy` field (required) 2055 pub fn applied_by( 2056 mut self, 2057 value: impl Into<crate::sh_weaver::actor::ProfileViewBasic<'a>>, 2058 ) -> TagApplicationViewBuilder<'a, tag_application_view_state::SetAppliedBy<S>> { 2059 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 2060 TagApplicationViewBuilder { 2061 _phantom_state: ::core::marker::PhantomData, 2062 __unsafe_private_named: self.__unsafe_private_named, 2063 _phantom: ::core::marker::PhantomData, 2064 } 2065 } 2066} 2067 2068impl<'a, S> TagApplicationViewBuilder<'a, S> 2069where 2070 S: tag_application_view_state::State, 2071 S::CreatedAt: tag_application_view_state::IsUnset, 2072{ 2073 /// Set the `createdAt` field (required) 2074 pub fn created_at( 2075 mut self, 2076 value: impl Into<jacquard_common::types::string::Datetime>, 2077 ) -> TagApplicationViewBuilder<'a, tag_application_view_state::SetCreatedAt<S>> { 2078 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 2079 TagApplicationViewBuilder { 2080 _phantom_state: ::core::marker::PhantomData, 2081 __unsafe_private_named: self.__unsafe_private_named, 2082 _phantom: ::core::marker::PhantomData, 2083 } 2084 } 2085} 2086 2087impl<'a, S> TagApplicationViewBuilder<'a, S> 2088where 2089 S: tag_application_view_state::State, 2090 S::Tag: tag_application_view_state::IsUnset, 2091{ 2092 /// Set the `tag` field (required) 2093 pub fn tag( 2094 mut self, 2095 value: impl Into<jacquard_common::CowStr<'a>>, 2096 ) -> TagApplicationViewBuilder<'a, tag_application_view_state::SetTag<S>> { 2097 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 2098 TagApplicationViewBuilder { 2099 _phantom_state: ::core::marker::PhantomData, 2100 __unsafe_private_named: self.__unsafe_private_named, 2101 _phantom: ::core::marker::PhantomData, 2102 } 2103 } 2104} 2105 2106impl<'a, S> TagApplicationViewBuilder<'a, S> 2107where 2108 S: tag_application_view_state::State, 2109 S::Uri: tag_application_view_state::IsUnset, 2110{ 2111 /// Set the `uri` field (required) 2112 pub fn uri( 2113 mut self, 2114 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 2115 ) -> TagApplicationViewBuilder<'a, tag_application_view_state::SetUri<S>> { 2116 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); 2117 TagApplicationViewBuilder { 2118 _phantom_state: ::core::marker::PhantomData, 2119 __unsafe_private_named: self.__unsafe_private_named, 2120 _phantom: ::core::marker::PhantomData, 2121 } 2122 } 2123} 2124 2125impl<'a, S> TagApplicationViewBuilder<'a, S> 2126where 2127 S: tag_application_view_state::State, 2128 S::AppliedBy: tag_application_view_state::IsSet, 2129 S::Uri: tag_application_view_state::IsSet, 2130 S::Tag: tag_application_view_state::IsSet, 2131 S::CreatedAt: tag_application_view_state::IsSet, 2132{ 2133 /// Build the final struct 2134 pub fn build(self) -> TagApplicationView<'a> { 2135 TagApplicationView { 2136 applied_by: self.__unsafe_private_named.0.unwrap(), 2137 created_at: self.__unsafe_private_named.1.unwrap(), 2138 tag: self.__unsafe_private_named.2.unwrap(), 2139 uri: self.__unsafe_private_named.3.unwrap(), 2140 extra_data: Default::default(), 2141 } 2142 } 2143 /// Build the final struct with custom extra_data 2144 pub fn build_with_data( 2145 self, 2146 extra_data: std::collections::BTreeMap< 2147 jacquard_common::smol_str::SmolStr, 2148 jacquard_common::types::value::Data<'a>, 2149 >, 2150 ) -> TagApplicationView<'a> { 2151 TagApplicationView { 2152 applied_by: self.__unsafe_private_named.0.unwrap(), 2153 created_at: self.__unsafe_private_named.1.unwrap(), 2154 tag: self.__unsafe_private_named.2.unwrap(), 2155 uri: self.__unsafe_private_named.3.unwrap(), 2156 extra_data: Some(extra_data), 2157 } 2158 } 2159} 2160 2161impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TagApplicationView<'a> { 2162 fn nsid() -> &'static str { 2163 "sh.weaver.graph.defs" 2164 } 2165 fn def_name() -> &'static str { 2166 "tagApplicationView" 2167 } 2168 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 2169 lexicon_doc_sh_weaver_graph_defs() 2170 } 2171 fn validate( 2172 &self, 2173 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 2174 Ok(()) 2175 } 2176} 2177 2178/// Aggregated view of a tag with usage statistics. 2179#[jacquard_derive::lexicon] 2180#[derive( 2181 serde::Serialize, 2182 serde::Deserialize, 2183 Debug, 2184 Clone, 2185 PartialEq, 2186 Eq, 2187 jacquard_derive::IntoStatic 2188)] 2189#[serde(rename_all = "camelCase")] 2190pub struct TagView<'a> { 2191 #[serde(skip_serializing_if = "std::option::Option::is_none")] 2192 pub entry_count: std::option::Option<i64>, 2193 #[serde(skip_serializing_if = "std::option::Option::is_none")] 2194 pub notebook_count: std::option::Option<i64>, 2195 /// Uses in the last 30 days. 2196 #[serde(skip_serializing_if = "std::option::Option::is_none")] 2197 pub recent_use_count: std::option::Option<i64>, 2198 #[serde(borrow)] 2199 pub tag: jacquard_common::CowStr<'a>, 2200 /// Appview-computed trending score. 2201 #[serde(skip_serializing_if = "std::option::Option::is_none")] 2202 pub trending_score: std::option::Option<i64>, 2203 /// Total number of resources tagged with this tag. 2204 pub use_count: i64, 2205} 2206 2207pub mod tag_view_state { 2208 2209 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 2210 #[allow(unused)] 2211 use ::core::marker::PhantomData; 2212 mod sealed { 2213 pub trait Sealed {} 2214 } 2215 /// State trait tracking which required fields have been set 2216 pub trait State: sealed::Sealed { 2217 type Tag; 2218 type UseCount; 2219 } 2220 /// Empty state - all required fields are unset 2221 pub struct Empty(()); 2222 impl sealed::Sealed for Empty {} 2223 impl State for Empty { 2224 type Tag = Unset; 2225 type UseCount = Unset; 2226 } 2227 ///State transition - sets the `tag` field to Set 2228 pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); 2229 impl<S: State> sealed::Sealed for SetTag<S> {} 2230 impl<S: State> State for SetTag<S> { 2231 type Tag = Set<members::tag>; 2232 type UseCount = S::UseCount; 2233 } 2234 ///State transition - sets the `use_count` field to Set 2235 pub struct SetUseCount<S: State = Empty>(PhantomData<fn() -> S>); 2236 impl<S: State> sealed::Sealed for SetUseCount<S> {} 2237 impl<S: State> State for SetUseCount<S> { 2238 type Tag = S::Tag; 2239 type UseCount = Set<members::use_count>; 2240 } 2241 /// Marker types for field names 2242 #[allow(non_camel_case_types)] 2243 pub mod members { 2244 ///Marker type for the `tag` field 2245 pub struct tag(()); 2246 ///Marker type for the `use_count` field 2247 pub struct use_count(()); 2248 } 2249} 2250 2251/// Builder for constructing an instance of this type 2252pub struct TagViewBuilder<'a, S: tag_view_state::State> { 2253 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 2254 __unsafe_private_named: ( 2255 ::core::option::Option<i64>, 2256 ::core::option::Option<i64>, 2257 ::core::option::Option<i64>, 2258 ::core::option::Option<jacquard_common::CowStr<'a>>, 2259 ::core::option::Option<i64>, 2260 ::core::option::Option<i64>, 2261 ), 2262 _phantom: ::core::marker::PhantomData<&'a ()>, 2263} 2264 2265impl<'a> TagView<'a> { 2266 /// Create a new builder for this type 2267 pub fn new() -> TagViewBuilder<'a, tag_view_state::Empty> { 2268 TagViewBuilder::new() 2269 } 2270} 2271 2272impl<'a> TagViewBuilder<'a, tag_view_state::Empty> { 2273 /// Create a new builder with all fields unset 2274 pub fn new() -> Self { 2275 TagViewBuilder { 2276 _phantom_state: ::core::marker::PhantomData, 2277 __unsafe_private_named: (None, None, None, None, None, None), 2278 _phantom: ::core::marker::PhantomData, 2279 } 2280 } 2281} 2282 2283impl<'a, S: tag_view_state::State> TagViewBuilder<'a, S> { 2284 /// Set the `entryCount` field (optional) 2285 pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self { 2286 self.__unsafe_private_named.0 = value.into(); 2287 self 2288 } 2289 /// Set the `entryCount` field to an Option value (optional) 2290 pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self { 2291 self.__unsafe_private_named.0 = value; 2292 self 2293 } 2294} 2295 2296impl<'a, S: tag_view_state::State> TagViewBuilder<'a, S> { 2297 /// Set the `notebookCount` field (optional) 2298 pub fn notebook_count(mut self, value: impl Into<Option<i64>>) -> Self { 2299 self.__unsafe_private_named.1 = value.into(); 2300 self 2301 } 2302 /// Set the `notebookCount` field to an Option value (optional) 2303 pub fn maybe_notebook_count(mut self, value: Option<i64>) -> Self { 2304 self.__unsafe_private_named.1 = value; 2305 self 2306 } 2307} 2308 2309impl<'a, S: tag_view_state::State> TagViewBuilder<'a, S> { 2310 /// Set the `recentUseCount` field (optional) 2311 pub fn recent_use_count(mut self, value: impl Into<Option<i64>>) -> Self { 2312 self.__unsafe_private_named.2 = value.into(); 2313 self 2314 } 2315 /// Set the `recentUseCount` field to an Option value (optional) 2316 pub fn maybe_recent_use_count(mut self, value: Option<i64>) -> Self { 2317 self.__unsafe_private_named.2 = value; 2318 self 2319 } 2320} 2321 2322impl<'a, S> TagViewBuilder<'a, S> 2323where 2324 S: tag_view_state::State, 2325 S::Tag: tag_view_state::IsUnset, 2326{ 2327 /// Set the `tag` field (required) 2328 pub fn tag( 2329 mut self, 2330 value: impl Into<jacquard_common::CowStr<'a>>, 2331 ) -> TagViewBuilder<'a, tag_view_state::SetTag<S>> { 2332 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); 2333 TagViewBuilder { 2334 _phantom_state: ::core::marker::PhantomData, 2335 __unsafe_private_named: self.__unsafe_private_named, 2336 _phantom: ::core::marker::PhantomData, 2337 } 2338 } 2339} 2340 2341impl<'a, S: tag_view_state::State> TagViewBuilder<'a, S> { 2342 /// Set the `trendingScore` field (optional) 2343 pub fn trending_score(mut self, value: impl Into<Option<i64>>) -> Self { 2344 self.__unsafe_private_named.4 = value.into(); 2345 self 2346 } 2347 /// Set the `trendingScore` field to an Option value (optional) 2348 pub fn maybe_trending_score(mut self, value: Option<i64>) -> Self { 2349 self.__unsafe_private_named.4 = value; 2350 self 2351 } 2352} 2353 2354impl<'a, S> TagViewBuilder<'a, S> 2355where 2356 S: tag_view_state::State, 2357 S::UseCount: tag_view_state::IsUnset, 2358{ 2359 /// Set the `useCount` field (required) 2360 pub fn use_count( 2361 mut self, 2362 value: impl Into<i64>, 2363 ) -> TagViewBuilder<'a, tag_view_state::SetUseCount<S>> { 2364 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); 2365 TagViewBuilder { 2366 _phantom_state: ::core::marker::PhantomData, 2367 __unsafe_private_named: self.__unsafe_private_named, 2368 _phantom: ::core::marker::PhantomData, 2369 } 2370 } 2371} 2372 2373impl<'a, S> TagViewBuilder<'a, S> 2374where 2375 S: tag_view_state::State, 2376 S::Tag: tag_view_state::IsSet, 2377 S::UseCount: tag_view_state::IsSet, 2378{ 2379 /// Build the final struct 2380 pub fn build(self) -> TagView<'a> { 2381 TagView { 2382 entry_count: self.__unsafe_private_named.0, 2383 notebook_count: self.__unsafe_private_named.1, 2384 recent_use_count: self.__unsafe_private_named.2, 2385 tag: self.__unsafe_private_named.3.unwrap(), 2386 trending_score: self.__unsafe_private_named.4, 2387 use_count: self.__unsafe_private_named.5.unwrap(), 2388 extra_data: Default::default(), 2389 } 2390 } 2391 /// Build the final struct with custom extra_data 2392 pub fn build_with_data( 2393 self, 2394 extra_data: std::collections::BTreeMap< 2395 jacquard_common::smol_str::SmolStr, 2396 jacquard_common::types::value::Data<'a>, 2397 >, 2398 ) -> TagView<'a> { 2399 TagView { 2400 entry_count: self.__unsafe_private_named.0, 2401 notebook_count: self.__unsafe_private_named.1, 2402 recent_use_count: self.__unsafe_private_named.2, 2403 tag: self.__unsafe_private_named.3.unwrap(), 2404 trending_score: self.__unsafe_private_named.4, 2405 use_count: self.__unsafe_private_named.5.unwrap(), 2406 extra_data: Some(extra_data), 2407 } 2408 } 2409} 2410 2411impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TagView<'a> { 2412 fn nsid() -> &'static str { 2413 "sh.weaver.graph.defs" 2414 } 2415 fn def_name() -> &'static str { 2416 "tagView" 2417 } 2418 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 2419 lexicon_doc_sh_weaver_graph_defs() 2420 } 2421 fn validate( 2422 &self, 2423 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 2424 Ok(()) 2425 } 2426}